Luke Childs
8 years ago
2 changed files with 25 additions and 2 deletions
@ -1,12 +1,34 @@ |
|||
import test from 'ava'; |
|||
import jsdom from 'jsdom'; |
|||
import domLoaded from '../'; |
|||
|
|||
test('domLoaded runs the callback', async t => { |
|||
test('callback fires with global window', async t => { |
|||
t.plan(1); |
|||
domLoaded(() => t.pass()); |
|||
}); |
|||
|
|||
test('domLoaded Promise resolves', async t => { |
|||
test('Promise resolves with global window', async t => { |
|||
t.plan(1); |
|||
domLoaded().then(() => t.pass()); |
|||
}); |
|||
|
|||
test('callback fires with local document', async t => { |
|||
t.plan(1); |
|||
const config = { |
|||
html: '', |
|||
onload: window => domLoaded(() => t.pass(), window.document) |
|||
}; |
|||
jsdom.env(config); |
|||
}); |
|||
|
|||
test.cb('Promise resolves with local document', t => { |
|||
t.plan(1); |
|||
const config = { |
|||
html: '', |
|||
onload: window => domLoaded(window.document).then(() => { |
|||
t.pass(); |
|||
t.end(); |
|||
}) |
|||
}; |
|||
jsdom.env(config); |
|||
}); |
|||
|
Loading…
Reference in new issue