summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/document-metadata/the-meta-element/color-scheme/meta-color-scheme-attribute-changes.html
blob: 6f877ee416890abf96b43ec50fa93e9848a0d425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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>