mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision b'ee6da9d71d0268d7fdb04e8e5b26858f46ee0cc4'
This commit is contained in:
parent
4401622eb1
commit
b77ad115f6
16832 changed files with 270819 additions and 87621 deletions
|
@ -3,7 +3,7 @@
|
|||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#domtokenlist">
|
||||
<link rel="help" href="https://heycam.github.io/webidl/#ecmascript-binding">
|
||||
<link rel="help" href="https://webidl.spec.whatwg.org/#ecmascript-binding">
|
||||
<link rel="help" href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf#page=57">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
<link rel="help" href="https://html.spec.whatwg.org/multipage/links.html#link-type-stylesheet">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link href="style.css?pipe=trickle(d3)" rel="stylesheet" id="style_test">
|
||||
<link href="style.css" rel="stylesheet" id="style_test">
|
||||
<script>
|
||||
test(function() {
|
||||
assert_true(document.styleSheets.length === 1 &&
|
||||
document.styleSheets[0].href.includes("style.css"),
|
||||
"The style sheet 'style.css' must be available to scripts");
|
||||
|
||||
style_test.href = "resources/neutral.css?pipe=trickle(d3)";
|
||||
style_test.href = "resources/neutral.css?pipe=trickle(d1)";
|
||||
|
||||
assert_true(document.styleSheets.length === 1 &&
|
||||
document.styleSheets[0].href.includes("style.css"),
|
||||
|
|
|
@ -5,24 +5,31 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<!--
|
||||
NOTE: This test assumes that the browser's default color-scheme is "light",
|
||||
see https://github.com/web-platform-tests/wpt/pull/31268 for reasoning
|
||||
-->
|
||||
<script>
|
||||
assert_root_color_scheme("dark", "Meta color-scheme initially 'dark'.");
|
||||
|
||||
meta.removeAttribute("name");
|
||||
assert_root_color_scheme("normal", "Removed name attribute from meta color-scheme.");
|
||||
assert_root_color_scheme("light", "Removed name attribute from meta color-scheme.");
|
||||
|
||||
meta.setAttribute("name", "color-scheme");
|
||||
assert_root_color_scheme("dark", "Set meta name to color-scheme.");
|
||||
|
||||
meta.setAttribute("content", "");
|
||||
assert_root_color_scheme("normal", "Set content attribute of meta color-scheme to empty string.");
|
||||
assert_root_color_scheme("light", "Set content attribute of meta color-scheme to empty string.");
|
||||
|
||||
meta.setAttribute("content", ",,invalid");
|
||||
assert_root_color_scheme("normal", "Set content attribute of meta color-scheme to an invalid value.");
|
||||
assert_root_color_scheme("light", "Set content attribute of meta color-scheme to an invalid value.");
|
||||
|
||||
meta.setAttribute("content", "light");
|
||||
assert_root_color_scheme("light", "Set content attribute of meta color-scheme to 'light'.");
|
||||
|
||||
meta.setAttribute("content", "dark");
|
||||
assert_root_color_scheme("dark", "Set content attribute of meta color-scheme to 'dark'.");
|
||||
|
||||
meta.removeAttribute("content");
|
||||
assert_root_color_scheme("normal", "Removed the content attribute of meta color-scheme.");
|
||||
assert_root_color_scheme("light", "Removed the content attribute of meta color-scheme.");
|
||||
</script>
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<!--
|
||||
NOTE: This test assumes that the browser's default color-scheme is "light",
|
||||
see https://github.com/web-platform-tests/wpt/pull/31268 for reasoning
|
||||
-->
|
||||
<script>
|
||||
assert_root_color_scheme("normal", "Meta color-scheme with empty content attribute has no effect.");
|
||||
assert_root_color_scheme("light", "Meta color-scheme with empty content attribute has no effect.");
|
||||
</script>
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<!--
|
||||
NOTE: This test assumes that the browser's default color-scheme is "light",
|
||||
see https://github.com/web-platform-tests/wpt/pull/31268 for reasoning
|
||||
-->
|
||||
<script>
|
||||
function createMeta(content) {
|
||||
const meta = document.createElement("meta");
|
||||
|
@ -12,11 +16,11 @@
|
|||
return meta;
|
||||
}
|
||||
|
||||
assert_root_color_scheme("normal", "Initial color-scheme");
|
||||
assert_root_color_scheme("light", "Initial color-scheme");
|
||||
|
||||
document.head.appendChild(createMeta("light"));
|
||||
assert_root_color_scheme("light", "Inserted meta color-scheme applies");
|
||||
document.head.appendChild(createMeta("dark"));
|
||||
assert_root_color_scheme("dark", "Inserted meta color-scheme applies");
|
||||
|
||||
document.head.insertBefore(createMeta("dark"), document.head.lastChild);
|
||||
assert_root_color_scheme("dark", "Inserted meta color-scheme before existing in head applies");
|
||||
document.head.insertBefore(createMeta("light"), document.head.lastChild);
|
||||
assert_root_color_scheme("light", "Inserted meta color-scheme before existing in head applies");
|
||||
</script>
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<!--
|
||||
NOTE: This test assumes that the browser's default color-scheme is "light",
|
||||
see https://github.com/web-platform-tests/wpt/pull/31268 for reasoning
|
||||
-->
|
||||
<script>
|
||||
assert_root_color_scheme("normal", "Meta color-scheme without content attribute has no effect.");
|
||||
assert_root_color_scheme("light", "Meta color-scheme without content attribute has no effect.");
|
||||
</script>
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>Meta color-scheme - presentational hint</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#meta-color-scheme">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<style>
|
||||
* { color-scheme: light }
|
||||
</style>
|
||||
<meta name="color-scheme" content="dark">
|
||||
<script>
|
||||
// Author level CSS color-scheme property overrides meta color-scheme value
|
||||
// which is at the presentational hint cascade order.
|
||||
assert_root_color_scheme("light", "Author origin style rule overrides meta color-scheme.");
|
||||
</script>
|
|
@ -5,9 +5,13 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<!--
|
||||
NOTE: This test assumes that the browser's default color-scheme is "light",
|
||||
see https://github.com/web-platform-tests/wpt/pull/31268 for reasoning
|
||||
-->
|
||||
<body></body>
|
||||
<script>
|
||||
assert_root_color_scheme("dark", "Meta color-scheme applies.");
|
||||
document.head.remove();
|
||||
assert_root_color_scheme("normal", "Initial value after removing head including meta color-scheme.");
|
||||
assert_root_color_scheme("light", "Initial value after removing head including meta color-scheme.");
|
||||
</script>
|
||||
|
|
|
@ -6,10 +6,14 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<!--
|
||||
NOTE: This test assumes that the browser's default color-scheme is "light",
|
||||
see https://github.com/web-platform-tests/wpt/pull/31268 for reasoning
|
||||
-->
|
||||
<script>
|
||||
assert_root_color_scheme("dark", "First meta applies.");
|
||||
dark.remove();
|
||||
assert_root_color_scheme("light", "Second meta applies after first one is removed.");
|
||||
light.remove();
|
||||
assert_root_color_scheme("normal", "Initial color-scheme with both meta elements removed.");
|
||||
assert_root_color_scheme("light", "Initial color-scheme with both meta elements removed.");
|
||||
</script>
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/compute-root-color-scheme.js"></script>
|
||||
<!--
|
||||
NOTE: This test assumes that the browser's default color-scheme is "light",
|
||||
see https://github.com/web-platform-tests/wpt/pull/31268 for reasoning
|
||||
-->
|
||||
<script>
|
||||
const host = document.createElement("div");
|
||||
host.id = "host";
|
||||
|
@ -14,5 +18,5 @@
|
|||
meta.setAttribute("content", "dark");
|
||||
root.appendChild(meta);
|
||||
|
||||
assert_root_color_scheme("normal", "Meta color-scheme in shadow tree does not apply.");
|
||||
assert_root_color_scheme("light", "Meta color-scheme in shadow tree does not apply.");
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
function assert_root_color_scheme(expected, description) {
|
||||
function assert_root_color_scheme(expected_used_scheme, description) {
|
||||
function get_used_root_color_scheme() {
|
||||
let light = get_system_color("only light", "CanvasText");
|
||||
let dark = get_system_color("only dark", "CanvasText");
|
||||
assert_not_equals(light, dark, "CanvasText system color should be different with light and dark color schemes");
|
||||
let root = getComputedStyle(document.documentElement).color;
|
||||
assert_in_array(root, [light, dark], "Root color scheme should be either light or dark, or the text needs to be extended for newer color-schemes");
|
||||
return root == light ? "light" : "dark";
|
||||
}
|
||||
|
||||
function get_system_color(scheme, color) {
|
||||
let div = document.createElement("div");
|
||||
div.style.color = color;
|
||||
div.style.colorScheme = scheme;
|
||||
|
||||
document.documentElement.appendChild(div);
|
||||
let computed = getComputedStyle(div).color;
|
||||
div.remove();
|
||||
return computed;
|
||||
}
|
||||
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(document.documentElement).colorScheme, expected), "Check root element color scheme";
|
||||
assert_equals(get_used_root_color_scheme(), expected_used_scheme);
|
||||
assert_equals(getComputedStyle(document.documentElement).colorScheme, "normal", "Root element's color-scheme should be 'normal'");
|
||||
}, description);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue