File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 3737 "chai" : " ^3.5.0" ,
3838 "enzyme" : " ^2.7.1" ,
3939 "eslint" : " ^3.15.0" ,
40- "eslint-config-airbnb" : " ^14.1 .0" ,
40+ "eslint-config-airbnb" : " ^15.0 .0" ,
4141 "eslint-import-resolver-webpack" : " ^0.8.1" ,
4242 "eslint-plugin-import" : " ^2.2.0" ,
43- "eslint-plugin-jsx-a11y" : " ^4 .0.0 " ,
44- "eslint-plugin-react" : " ^6.9.0 " ,
43+ "eslint-plugin-jsx-a11y" : " ^5 .0.1 " ,
44+ "eslint-plugin-react" : " ^7.0.1 " ,
4545 "gulp" : " ^3.9.1" ,
46- "gulp-autoprefixer" : " ^3.1.1 " ,
46+ "gulp-autoprefixer" : " ^4.0.0 " ,
4747 "gulp-eslint" : " ^3.0.1" ,
4848 "gulp-header" : " ^1.8.8" ,
4949 "gulp-mocha" : " ^4.0.1" ,
5050 "gulp-sass" : " ^3.0.0" ,
5151 "gulp-scss-lint" : " ^0.4.0" ,
52- "jsdom" : " ^9.11 .0" ,
52+ "jsdom" : " ^10.1 .0" ,
5353 "mocha" : " ^3.0.2" ,
5454 "react" : " ^15.4.2" ,
5555 "react-addons-test-utils" : " ^15.4.2" ,
Original file line number Diff line number Diff line change 1- import { jsdom } from 'jsdom' ;
1+ const { JSDOM } = require ( 'jsdom' ) ;
22
3- global . document = jsdom ( '' ) ;
4- global . window = document . defaultView ;
5- Object . keys ( document . defaultView ) . forEach ( ( property ) => {
6- if ( typeof global [ property ] === 'undefined' ) {
7- global [ property ] = document . defaultView [ property ] ;
8- }
9- } ) ;
3+ const jsdom = new JSDOM ( '<!DOCTYPE html><html><body></body></html>' ) ;
4+ const { window } = jsdom ;
105
6+ function copyProps ( src , target ) {
7+ const props = Object . getOwnPropertyNames ( src )
8+ . filter ( prop => typeof target [ prop ] === 'undefined' )
9+ . map ( prop => Object . getOwnPropertyDescriptor ( src , prop ) ) ;
10+ Object . defineProperties ( target , props ) ;
11+ }
12+
13+ global . window = window ;
14+ global . document = window . document ;
1115global . navigator = {
1216 userAgent : 'node.js' ,
1317} ;
18+ copyProps ( window , global ) ;
You can’t perform that action at this time.
0 commit comments