diff options
Diffstat (limited to 'spec/javascript/setup.js')
-rw-r--r-- | spec/javascript/setup.js | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/spec/javascript/setup.js b/spec/javascript/setup.js index 7d4b2866e..c9c8aed07 100644 --- a/spec/javascript/setup.js +++ b/spec/javascript/setup.js @@ -1,19 +1,13 @@ -import { jsdom } from 'jsdom/lib/old-api'; +import { JSDOM } from 'jsdom'; import chai from 'chai'; import chaiEnzyme from 'chai-enzyme'; chai.use(chaiEnzyme()); -var exposedProperties = ['window', 'navigator', 'document']; - -global.document = jsdom(''); -global.window = document.defaultView; -Object.keys(document.defaultView).forEach((property) => { +const { window } = new JSDOM('', { + userAgent: 'node.js', +}); +Object.keys(window).forEach(property => { if (typeof global[property] === 'undefined') { - exposedProperties.push(property); - global[property] = document.defaultView[property]; + global[property] = window[property]; } }); - -global.navigator = { - userAgent: 'node.js', -}; |