Browse Source

Update the way we get properties to work with latest jsdom

pull/2/head
Luke Childs 9 years ago
parent
commit
2cea73d0cf
  1. 13
      src/index.js

13
src/index.js

@ -1,10 +1,16 @@
import { jsdom } from 'jsdom';
function getWindowPropertyKeys(window) {
return Object
.keys(window)
.concat(Object.keys(window._core))
.filter(prop => prop.substring(0, 1) !== '_');
}
const protectedproperties = (() => {
const window = jsdom('<html><body></body></html>').defaultView;
return Object
.keys(window)
return getWindowPropertyKeys(window)
.filter(prop => global[prop]);
})();
@ -16,8 +22,7 @@ module.exports = (...args) => {
const window = jsdom('<html><body></body></html>', jsdomConfig).defaultView;
Object
.keys(window)
getWindowPropertyKeys(window)
.filter(prop => protectedproperties.indexOf(prop) === -1)
.filter(prop => !(properties && properties.indexOf(prop) === -1))
.forEach(prop => global[prop] = window[prop]);

Loading…
Cancel
Save