test.js 521 B

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