use_each.js
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* global describe, it, expect */
/* jshint expr: true */
var jsdom = require('../index')
describe('check useEach false (default)', function () {
var someContent = '<div>hola</div>'
jsdom()
it('check that html body is empty', function () {
expect(document.body.innerHTML).to.be.empty // eslint-disable-line no-unused-expressions
})
it('accepts an html body', function () {
document.body.innerHTML = someContent
expect(document.body.innerHTML).eql(someContent)
})
it('has document persisting across tests', function () {
expect(document.body.innerHTML).eql(someContent)
})
})
describe('check useEach true', function () {
var someContent = '<div>hola</div>'
jsdom({ useEach: true })
it('check that html body is empty', function () {
expect(document.body.innerHTML).to.be.empty // eslint-disable-line no-unused-expressions
})
it('accepts an html body', function () {
document.body.innerHTML = someContent
expect(document.body.innerHTML).eql(someContent)
})
it('changes to the dom do not persist between tests', function () {
expect(document.body.innerHTML).to.be.empty // eslint-disable-line no-unused-expressions
})
})