summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/document-metadata/the-meta-element/color-scheme/meta-color-scheme-attribute-changes.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/document-metadata/the-meta-element/color-scheme/meta-color-scheme-attribute-changes.html')
-rw-r--r--testing/web-platform/tests/html/semantics/document-metadata/the-meta-element/color-scheme/meta-color-scheme-attribute-changes.html35
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/document-metadata/the-meta-element/color-scheme/meta-color-scheme-attribute-changes.html b/testing/web-platform/tests/html/semantics/document-metadata/the-meta-element/color-scheme/meta-color-scheme-attribute-changes.html
new file mode 100644
index 0000000000..6f877ee416
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/document-metadata/the-meta-element/color-scheme/meta-color-scheme-attribute-changes.html
@@ -0,0 +1,35 @@
+<!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>
+<!--
+ 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("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("light", "Set content attribute of meta color-scheme to empty string.");
+
+ meta.setAttribute("content", ",,invalid");
+ 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("light", "Removed the content attribute of meta color-scheme.");
+</script>