Browse Source

Update to jsdom v13.2.0

* 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
parent
commit
9882415f22
  1. 9551
      package-lock.json
  2. 8
      package.json
  3. 14
      src/index.js
  4. 108
      test/fixtures/expectedProperties.json
  5. 2
      test/types.js
  6. 14
      test/unit.js

9551
package-lock.json

File diff suppressed because it is too large

8
package.json

@ -35,13 +35,13 @@
}, },
"homepage": "https://github.com/lukechilds/window#readme", "homepage": "https://github.com/lukechilds/window#readme",
"dependencies": { "dependencies": {
"jsdom": "11.6.2" "jsdom": "13.2.0"
}, },
"devDependencies": { "devDependencies": {
"ava": "^0.25.0", "ava": "^1.2.0",
"coveralls": "^3.0.0", "coveralls": "^3.0.0",
"eslint-config-xo-lukechilds": "^1.0.0", "eslint-config-xo-lukechilds": "^1.0.0",
"nyc": "^11.0.2", "nyc": "^13.1.0",
"xo": "^0.18.2" "xo": "^0.24.0"
} }
} }

14
src/index.js

@ -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;
} }
}; };

108
test/fixtures/expectedProperties.json

@ -93,6 +93,7 @@
"HTMLQuoteElement", "HTMLQuoteElement",
"HTMLScriptElement", "HTMLScriptElement",
"HTMLSelectElement", "HTMLSelectElement",
"HTMLSlotElement",
"HTMLSourceElement", "HTMLSourceElement",
"HTMLSpanElement", "HTMLSpanElement",
"HTMLStyleElement", "HTMLStyleElement",
@ -113,6 +114,7 @@
"HashChangeEvent", "HashChangeEvent",
"History", "History",
"Image", "Image",
"InputEvent",
"Int16Array", "Int16Array",
"Int32Array", "Int32Array",
"Int8Array", "Int8Array",
@ -120,7 +122,11 @@
"Location", "Location",
"MediaList", "MediaList",
"MessageEvent", "MessageEvent",
"MimeType",
"MimeTypeArray",
"MouseEvent", "MouseEvent",
"MutationObserver",
"MutationRecord",
"NamedNodeMap", "NamedNodeMap",
"Node", "Node",
"NodeFilter", "NodeFilter",
@ -128,6 +134,8 @@
"NodeList", "NodeList",
"Option", "Option",
"Performance", "Performance",
"Plugin",
"PluginArray",
"PopStateEvent", "PopStateEvent",
"ProcessingInstruction", "ProcessingInstruction",
"ProgressEvent", "ProgressEvent",
@ -137,7 +145,11 @@
"SVGNumber", "SVGNumber",
"SVGSVGElement", "SVGSVGElement",
"SVGStringList", "SVGStringList",
"SVGTitleElement",
"Screen", "Screen",
"ShadowRoot",
"Storage",
"StorageEvent",
"StyleSheet", "StyleSheet",
"StyleSheetList", "StyleSheetList",
"Text", "Text",
@ -150,6 +162,7 @@
"Uint32Array", "Uint32Array",
"Uint8Array", "Uint8Array",
"Uint8ClampedArray", "Uint8ClampedArray",
"ValidityState",
"WebSocket", "WebSocket",
"WheelEvent", "WheelEvent",
"Window", "Window",
@ -157,21 +170,34 @@
"XMLHttpRequest", "XMLHttpRequest",
"XMLHttpRequestEventTarget", "XMLHttpRequestEventTarget",
"XMLHttpRequestUpload", "XMLHttpRequestUpload",
"XMLSerializer",
"XPathEvaluator", "XPathEvaluator",
"XPathException", "XPathException",
"XPathExpression", "XPathExpression",
"XPathResult", "XPathResult",
"__stopAllTimers", "__stopAllTimers",
"_commonForOrigin",
"_currentOriginData",
"_document", "_document",
"_eventHandlers", "_eventHandlers",
"_frameElement", "_frameElement",
"_getEventHandlerFor",
"_getEventHandlerTarget",
"_globalEventChanged",
"_globalProxy", "_globalProxy",
"_initGlobalEvents",
"_length", "_length",
"_localStorage",
"_parent", "_parent",
"_pretendToBeVisual", "_pretendToBeVisual",
"_proxyWindowEventsToWindow",
"_registeredHandlers", "_registeredHandlers",
"_resourceLoader",
"_runScripts", "_runScripts",
"_sessionHistory", "_sessionHistory",
"_sessionStorage",
"_setEventHandlerFor",
"_storageQuota",
"_top", "_top",
"_virtualConsole", "_virtualConsole",
"addEventListener", "addEventListener",
@ -197,6 +223,7 @@
"innerHeight", "innerHeight",
"innerWidth", "innerWidth",
"length", "length",
"localStorage",
"location", "location",
"locationbar", "locationbar",
"menubar", "menubar",
@ -204,6 +231,85 @@
"moveTo", "moveTo",
"name", "name",
"navigator", "navigator",
"onabort",
"onafterprint",
"onautocomplete",
"onautocompleteerror",
"onbeforeprint",
"onbeforeunload",
"onblur",
"oncancel",
"oncanplay",
"oncanplaythrough",
"onchange",
"onclick",
"onclose",
"oncontextmenu",
"oncuechange",
"ondblclick",
"ondrag",
"ondragend",
"ondragenter",
"ondragexit",
"ondragleave",
"ondragover",
"ondragstart",
"ondrop",
"ondurationchange",
"onemptied",
"onended",
"onerror",
"onfocus",
"onhashchange",
"oninput",
"oninvalid",
"onkeydown",
"onkeypress",
"onkeyup",
"onlanguagechange",
"onload",
"onloadeddata",
"onloadedmetadata",
"onloadstart",
"onmessage",
"onmessageerror",
"onmousedown",
"onmouseenter",
"onmouseleave",
"onmousemove",
"onmouseout",
"onmouseover",
"onmouseup",
"onoffline",
"ononline",
"onpagehide",
"onpageshow",
"onpause",
"onplay",
"onplaying",
"onpopstate",
"onprogress",
"onratechange",
"onrejectionhandled",
"onreset",
"onresize",
"onscroll",
"onsecuritypolicyviolation",
"onseeked",
"onseeking",
"onselect",
"onsort",
"onstalled",
"onstorage",
"onsubmit",
"onsuspend",
"ontimeupdate",
"ontoggle",
"onunhandledrejection",
"onunload",
"onvolumechange",
"onwaiting",
"onwheel",
"open", "open",
"outerHeight", "outerHeight",
"outerWidth", "outerWidth",
@ -231,8 +337,10 @@
"scrollY", "scrollY",
"scrollbars", "scrollbars",
"self", "self",
"sessionStorage",
"setInterval", "setInterval",
"setTimeout", "setTimeout",
"status",
"statusbar", "statusbar",
"stop", "stop",
"toolbar", "toolbar",

2
test/types.js

@ -1,6 +1,6 @@
/* eslint new-cap: ["error", { "capIsNew": false }] */ /* eslint new-cap: ["error", { "capIsNew": false }] */
import test from 'ava'; import test from 'ava';
import Window from '../'; import Window from '..';
test('Window is a class', t => { test('Window is a class', t => {
t.throws(() => Window()); t.throws(() => Window());

14
test/unit.js

@ -1,6 +1,6 @@
/* eslint new-cap: ["error", { "capIsNew": false }] */ /* eslint new-cap: ["error", { "capIsNew": false }] */
import test from 'ava'; import test from 'ava';
import Window from '../'; import Window from '..';
import expectedProperties from './fixtures/expectedProperties'; import expectedProperties from './fixtures/expectedProperties';
test('jsdom config is passed through', t => { test('jsdom config is passed through', t => {
@ -19,17 +19,5 @@ test('properties haven\'t changed', t => {
}); });
const properties = Object.getOwnPropertyNames(window); const properties = Object.getOwnPropertyNames(window);
expectedProperties.forEach(expected => {
if (properties.indexOf(expected) === -1) {
console.log('Removed:', expected);
}
});
properties.forEach(prop => {
if (expectedProperties.indexOf(prop) === -1) {
console.log('Added:', prop);
}
});
t.deepEqual(expectedProperties.sort(), properties.sort()); t.deepEqual(expectedProperties.sort(), properties.sort());
}); });

Loading…
Cancel
Save