diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/selectors/pseudo-classes/utils.js')
-rw-r--r-- | testing/web-platform/tests/html/semantics/selectors/pseudo-classes/utils.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/selectors/pseudo-classes/utils.js b/testing/web-platform/tests/html/semantics/selectors/pseudo-classes/utils.js new file mode 100644 index 0000000000..7a2fb77f10 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/selectors/pseudo-classes/utils.js @@ -0,0 +1,20 @@ +function getElementsByIds(ids) { + var result = []; + ids.forEach(function(id) { + result.push(document.getElementById(id)); + }); + return result; +} + +function testSelectorIdsMatch(selector, ids, testName) { + test(function(){ + var elements = document.querySelectorAll(selector); + assert_array_equals([...elements], getElementsByIds(ids)); + }, testName); +} + +function testSelectorElementsMatch(selector, elements, testName) { + test(function(){ + assert_array_equals([...document.querySelectorAll(selector)], elements); + }, testName); +} |