made with esnextbin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~'foo'.indexOf('oo'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright © John Leitch 2010 [email protected] | |
var destination = null; | |
var useClone = false; | |
var cloneSource = null; | |
var cloneDelay = 1000; | |
function hookInputs() { | |
var frame = document.getElementById('overlayFrame'); | |
var keyPressScript = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { expect } from 'chai'; | |
describe('dom', () => { | |
before(function () { | |
this.jsdom = require('jsdom-global')() | |
}) | |
after(function () { | |
this.jsdom() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tape from 'tape'; | |
import jsdom from 'jsdom-global'; | |
export function test (description, fn, { html } = {}) { | |
tape(description, t => { | |
const cleanup = jsdom(html); | |
fn(t); | |
cleanup(); | |
}); | |
} |
Notes
made with esnextbin
made with esnextbin
Notes
Writing tests for JavaScript code that interacts with the DOM can be tricky. Luckily, using a combination of AVA and jsdom, writing those tests becomes a lot easier.
This article will walk you through how to set everything up so you can get started writing your tests today.
AVA is described as a "Futuristic JavaScript test runner". Sounds fancy, huh?! So, what is it exactly that makes it "futuristic"?!