File tree Expand file tree Collapse file tree 3 files changed +220
-95
lines changed Expand file tree Collapse file tree 3 files changed +220
-95
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const chai = require ( 'chai' )
4
- const jsdom = require ( 'jsdom' ) . jsdom
4
+ const { JSDOM } = require ( 'jsdom' )
5
5
const sinonChai = require ( 'sinon-chai' )
6
6
7
- // http://airbnb.io/enzyme/docs/guides/jsdom.html
8
- global . document = jsdom ( '' )
7
+ const dom = new JSDOM ( `<!DOCTYPE html>` )
8
+
9
+ global . window = dom . window
10
+ global . document = dom . window . document
9
11
global . document . createRange = ( ) => ( {
10
12
commonAncestorContainer : global . document . body ,
11
13
setStart ( ) { } ,
12
14
setEnd ( ) { } ,
13
15
} )
14
- global . window = document . defaultView
15
- Object . keys ( document . defaultView ) . forEach ( ( property ) => {
16
- if ( typeof global [ property ] === 'undefined' ) {
17
- global [ property ] = document . defaultView [ property ]
18
- }
19
- } )
20
16
global . navigator = {
21
17
userAgent : 'node.js' ,
22
18
appVersion : { indexOf ( ) { } } ,
You can’t perform that action at this time.
0 commit comments