mirror of https://github.com/lukechilds/window.git
Browse Source
* Update dependencies and sync package-lock * Use the new jsdom's ResourceLoader. * Update expected properties. * Fix linting and remove property diffs logs (handled by ava). * No destructuring for node@6.pull/33/head
Guillaume Martigny
6 years ago
committed by
Luke Childs
6 changed files with 5556 additions and 4347 deletions
File diff suppressed because it is too large
@ -1,9 +1,17 @@ |
|||||
const { JSDOM } = require('jsdom'); |
const { JSDOM, ResourceLoader } = require('jsdom'); |
||||
|
|
||||
// Class to return a window instance.
|
// Class to return a window instance.
|
||||
// Accepts a jsdom config object.
|
// Accepts a jsdom config object.
|
||||
module.exports = class Window { |
module.exports = class Window { |
||||
constructor(jsdomConfig) { |
constructor(jsdomConfig = {}) { |
||||
return (new JSDOM('', jsdomConfig)).window; |
const { proxy, strictSSL, userAgent } = jsdomConfig; |
||||
|
const resources = new ResourceLoader({ |
||||
|
proxy, |
||||
|
strictSSL, |
||||
|
userAgent |
||||
|
}); |
||||
|
return (new JSDOM('', Object.assign(jsdomConfig, { |
||||
|
resources |
||||
|
}))).window; |
||||
} |
} |
||||
}; |
}; |
||||
|
Loading…
Reference in new issue