UNPKG

521 BJavaScriptView Raw
1var test = require('tape')
2var jsdom
3
4test('jsdom', function (t) {
5 jsdom = require('./index')()
6 t.end()
7})
8
9test('dom', function (t) {
10 var div = document.createElement('div')
11 div.innerHTML = 'hello'
12 document.body.appendChild(div)
13 t.equal(document.querySelector('body').innerHTML, '<div>hello</div>', 'dom works')
14 t.end()
15})
16
17test('cleanup', function (t) {
18 jsdom()
19 t.ok(typeof global.document === 'undefined', 'cleaned document')
20 t.ok(typeof global.alert === 'undefined', 'cleaned alert')
21 t.end()
22})