Skip to content

Commit

Permalink
Cherry pick web-platform-tests/wpt#6874 to fix this test.
Browse files Browse the repository at this point in the history
  • Loading branch information
upsuper committed Oct 10, 2017
1 parent 0564a1e commit 4667e81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tests/wpt/metadata/MANIFEST.json
Expand Up @@ -570101,7 +570101,7 @@
"testharness"
],
"dom/nodes/Element-closest.html": [
"4171fb8b70948ba2617e05b118aaf5d9367e916f",
"5abddb81959019267d8b69002ee95b011b2fe34a",
"testharness"
],
"dom/nodes/Element-firstElementChild-entity-xhtml.xhtml": [
Expand Down
3 changes: 3 additions & 0 deletions tests/wpt/metadata/dom/nodes/Element-closest.html.ini
Expand Up @@ -4,3 +4,6 @@
bug: https://github.com/servo/servo/issues/10781
expected: FAIL

[Element.closest with context node 'test4' and selector ':has(> :scope)']
expected: FAIL

18 changes: 4 additions & 14 deletions tests/wpt/web-platform-tests/dom/nodes/Element-closest.html
Expand Up @@ -56,11 +56,10 @@
do_test(":first-child" , "test12", "test3");
do_test(":invalid" , "test11", "test2");

do_scope_test(":scope" , "test4");
do_scope_test("select > :scope" , "test4");
do_scope_test("div > :scope" , "test4");
do_scope_test(":has(> :scope)" , "test4");

do_test(":scope" , "test4", "test4");
do_test("select > :scope" , "test4", "test4");
do_test("div > :scope" , "test4", "");
do_test(":has(> :scope)" , "test4", "test3");
function do_test(aSelector, aElementId, aTargetId) {
test(function() {
var el = document.getElementById(aElementId).closest(aSelector);
Expand All @@ -71,13 +70,4 @@
}
}, "Element.closest with context node '" + aElementId + "' and selector '" + aSelector + "'");
}

function do_scope_test(aSelector, aElementId) {
test(function() {
var el = document.getElementById(aElementId);
assert_throws("SYNTAX_ERR", function() {
el.closest(aSelector);
});
}, "Element.closest with context node '" + aElementId + "' and selector '" + aSelector + "' should throw");
}
</script>

0 comments on commit 4667e81

Please sign in to comment.