Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee

This commit is contained in:
WPT Sync Bot 2018-04-23 21:13:37 -04:00
parent c5f7c9ccf3
commit e891345f26
1328 changed files with 36632 additions and 20588 deletions

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<script src = "/resources/testharness.js"></script>
<script src = "/resources/testharnessreport.js"></script>
<link id="light-link" rel="stylesheet" href="resources/link-rel-attribute.css">
<div id="light-div" class="green">I"m green when light DOM link is on</div>
<div id="host">
I"m green when Shadow DOM link is on
<template id="shadow-dom">
<link id="shadow-link" rel="stylesheet" href="resources/link-rel-attribute.css">
<div id="shadow-div" class="green">
<slot></slot>
</div>
</template>
</div>
<script>
var host = document.querySelector("#host");
var shadow = host.attachShadow({ mode: "open" });
var tmpl = document.querySelector("template#shadow-dom");
var clone = document.importNode(tmpl.content, true);
shadow.appendChild(clone);
function testLinkRelModification(testDiv, testLink) {
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)");
testLink.setAttribute("rel", "no-stylesheet");
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 0, 0)");
testLink.setAttribute("rel", "stylesheet");
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 128, 0)");
testLink.removeAttribute("rel");
assert_equals(getComputedStyle(testDiv).color, "rgb(0, 0, 0)");
}
test (() => {
testLinkRelModification(document.querySelector("#light-div"),
document.querySelector("#light-link"));
}, "Removing stylesheet from link rel attribute should remove the stylesheet for light DOM");
test (() => {
testLinkRelModification(shadow.querySelector("#shadow-div"),
shadow.querySelector("#shadow-link"));
}, "Removing stylesheet from link rel attribute should remove the stylesheet for shadow DOM");
</script>

View file

@ -7,6 +7,10 @@
* avoids issues around caching of sheets based on URL.
*/
// Our URLs are random, so we don't use them in error messages by
// default, but enable doing it if someone wants to debug things.
const DEBUG_URLS = false;
var isHttps = location.protocol == "https:";
var tests = [
@ -113,12 +117,13 @@ for (var test of tests) {
var t = async_test(description);
var link = document.createElement("link");
link.rel = "stylesheet";
hrefString = DEBUG_URLS ? `: ${href}` : "";
if (success) {
link.onload = t.step_func_done(() => {});
link.onerror = t.step_func_done(() => assert_unreached(`error fired when load expected: ${href}`) );
link.onerror = t.step_func_done(() => assert_unreached(`error fired when load expected${hrefString}`) );
} else {
link.onerror = t.step_func_done(() => {});
link.onload = t.step_func_done(() => assert_unreached(`load fired when error expected: ${href}`) );
link.onload = t.step_func_done(() => assert_unreached(`load fired when error expected${hrefString}`) );
}
link.href = href;
document.head.appendChild(link);