mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision 0c112f38ee0040ba788d927e73b1ab1a7b856230
This commit is contained in:
parent
0baa1ea7bd
commit
3173ca7ad9
146 changed files with 1587 additions and 1659 deletions
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<title>Meta color-scheme - attribute changes</title>
|
||||
<meta id="meta" name="color-scheme" content="dark">
|
||||
<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>
|
||||
<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.");
|
||||
|
||||
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.");
|
||||
|
||||
meta.setAttribute("content", ",,invalid");
|
||||
assert_root_color_scheme("normal", "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.removeAttribute("content");
|
||||
assert_root_color_scheme("normal", "Removed the content attribute of meta color-scheme.");
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<title>Meta color-scheme - empty content value</title>
|
||||
<meta name="color-scheme" content="">
|
||||
<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>
|
||||
<script>
|
||||
assert_root_color_scheme("normal", "Meta color-scheme with empty content attribute has no effect.");
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<title>Multiple color-scheme meta tags - first valid applies</title>
|
||||
<meta name="color-scheme">
|
||||
<meta name="color-scheme" content>
|
||||
<meta name="color-scheme" content="">
|
||||
<meta name="color-scheme" content="light,dark">
|
||||
<!-- This is first with a valid content value -->
|
||||
<meta name="color-scheme" content="dark">
|
||||
<meta name="color-scheme" content="light">
|
||||
<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>
|
||||
<script>
|
||||
assert_root_color_scheme("dark", "Tree order decides which meta color-scheme applies.");
|
||||
</script>
|
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<title>Insert color-scheme meta tags</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>
|
||||
<script>
|
||||
function createMeta(content) {
|
||||
const meta = document.createElement("meta");
|
||||
meta.setAttribute("name", "color-scheme");
|
||||
meta.setAttribute("content", content);
|
||||
return meta;
|
||||
}
|
||||
|
||||
assert_root_color_scheme("normal", "Initial color-scheme");
|
||||
|
||||
document.head.appendChild(createMeta("light"));
|
||||
assert_root_color_scheme("light", "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");
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<title>Meta color-scheme - no content value</title>
|
||||
<meta name="color-scheme">
|
||||
<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>
|
||||
<script>
|
||||
assert_root_color_scheme("normal", "Meta color-scheme without content attribute has no effect.");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!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>
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<title>Remove head with meta color-scheme</title>
|
||||
<meta name="color-scheme" content="dark">
|
||||
<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>
|
||||
<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.");
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<title>Remove color-scheme meta tag</title>
|
||||
<meta id="dark" name="color-scheme" content="dark">
|
||||
<meta id="light" name="color-scheme" content="light">
|
||||
<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>
|
||||
<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.");
|
||||
</script>
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<title>Meta color-scheme in body should apply</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>
|
||||
<body>
|
||||
<meta name="color-scheme" content="dark">
|
||||
</body>
|
||||
<script>
|
||||
assert_root_color_scheme("dark", "Meta color-scheme in body should apply.");
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<title>Single meta color-scheme in head</title>
|
||||
<meta name="color-scheme" content="dark">
|
||||
<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>
|
||||
<script>
|
||||
assert_root_color_scheme("dark", "Meta color-scheme in head applies.");
|
||||
</script>
|
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<title>Meta color-scheme in shadow-tree should not apply</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>
|
||||
<script>
|
||||
const host = document.createElement("div");
|
||||
host.id = "host";
|
||||
document.head.appendChild(host);
|
||||
const root = host.attachShadow({mode:"open"});
|
||||
const meta = document.createElement("meta");
|
||||
meta.setAttribute("name", "color-scheme");
|
||||
meta.setAttribute("content", "dark");
|
||||
root.appendChild(meta);
|
||||
|
||||
assert_root_color_scheme("normal", "Meta color-scheme in shadow tree does not apply.");
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
function assert_root_color_scheme(expected, description) {
|
||||
test(() => {
|
||||
assert_equals(getComputedStyle(document.documentElement).colorScheme, expected), "Check root element color scheme";
|
||||
}, description);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue