Re-sync dom web-platform-tests from upstream
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / dom / idlharness.window.js
1 // META: script=/resources/WebIDLParser.js
2 // META: script=/resources/idlharness.js
3 // META: script=/common/subset-tests-by-key.js
4 // META: variant=?include=Node
5 // META: variant=?exclude=Node
6 // META: timeout=long
7
8 // Note: This isn't merged into idlharness.any.js because of the use of variants,
9 // i.e., include=Node wouldn't make sense for workers.
10
11 'use strict';
12
13 idl_test(
14   ['dom'],
15   ['html'],
16   idl_array => {
17     self.xmlDoc = document.implementation.createDocument(null, '', null);
18     self.detachedRange = document.createRange();
19     detachedRange.detach();
20     self.element = xmlDoc.createElementNS(null, 'test');
21     element.setAttribute('bar', 'baz');
22
23     idl_array.add_objects({
24       EventTarget: ['new EventTarget()'],
25       Event: ['document.createEvent("Event")', 'new Event("foo")'],
26       CustomEvent: ['new CustomEvent("foo")'],
27       AbortController: ['new AbortController()'],
28       AbortSignal: ['new AbortController().signal'],
29       Document: ['new Document()'],
30       XMLDocument: ['xmlDoc'],
31       DOMImplementation: ['document.implementation'],
32       DocumentFragment: ['document.createDocumentFragment()'],
33       DocumentType: ['document.doctype'],
34       Element: ['element'],
35       Attr: ['document.querySelector("[id]").attributes[0]'],
36       Text: ['document.createTextNode("abc")'],
37       ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'],
38       Comment: ['document.createComment("abc")'],
39       Range: ['document.createRange()', 'detachedRange'],
40       NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)'],
41       TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null, false)'],
42       NodeList: ['document.querySelectorAll("script")'],
43       HTMLCollection: ['document.body.children'],
44       DOMTokenList: ['document.body.classList'],
45       XPathEvaluator: ['new XPathEvaluator()'],
46       XPathExpression: ['document.createExpression("//*")'],
47       // Skipped due to https://github.com/web-platform-tests/wpt/issues/18827:
48       // XPathNSResolver: ['document.createNSResolver(document.body)'],
49       XPathResult: ['document.evaluate("//*", document.body)'],
50     });
51   }
52 );