test.js 521 Bytes
Newer Older
YazhouChen's avatar
YazhouChen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
var test = require('tape')
var jsdom

test('jsdom', function (t) {
  jsdom = require('./index')()
  t.end()
})

test('dom', function (t) {
  var div = document.createElement('div')
  div.innerHTML = 'hello'
  document.body.appendChild(div)
  t.equal(document.querySelector('body').innerHTML, '<div>hello</div>', 'dom works')
  t.end()
})

test('cleanup', function (t) {
  jsdom()
  t.ok(typeof global.document === 'undefined', 'cleaned document')
  t.ok(typeof global.alert === 'undefined', 'cleaned alert')
  t.end()
})