summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/forced-colors-mode/forced-colors-mode-40.html
blob: 481492d72e917a5b235b1aa55818519232ef32c1 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<meta charset="utf-8">
<title>Forced colors mode - computed value.
  Ensures that forced colors do not affect the computed style.
</title>
<link rel="help" href="https://www.w3.org/TR/css-color-adjust-1/#forced-colors-properties">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  div {
    background-color: green;
    border-color: green;
    caret-color: green;
    color: green;
    column-rule-color: green;
    fill: green;
    flood-color: green;
    lighting-color: green;
    outline-color: green;
    stop-color: green;
    stroke: green;
    text-decoration-color: green;
    -webkit-tap-highlight-color: green;
    -webkit-text-emphasis-color: green;
  }
</style>
<div id="div">
    Forced colors should not affect the computed style.
</div>

<script>
  const properties_to_test = [
    "background-color",
    "border-bottom-color",
    "border-left-color",
    "border-right-color",
    "border-top-color",
    "caret-color",
    "color",
    "column-rule-color",
    "fill",
    "flood-color",
    "lighting-color",
    "outline-color",
    "stop-color",
    "stroke",
    "text-decoration-color",
    "-webkit-tap-highlight-color",
    "-webkit-text-emphasis-color"
  ];
  for (let property of properties_to_test) {
    test(function() {
      let value = document.getElementById("div").computedStyleMap()
          .get(property).toString();
      assert_equals(value, "rgb(0, 128, 0)")
    }, "Forced colors aren't applied at computed value time for " + property);
  }
</script>