summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-ui/caret-color-016.html
blob: 25740ace9de25eb5dc51029ece760dafab0a5350 (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Basic User Interface Test: caret-color visited link computed value</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="http://www.w3.org/TR/css3-ui/#caret-color">
<link rel="help" href="https://www.w3.org/TR/css3-color/#color0">
<link rel="help" href="https://www.w3.org/TR/selectors4/#link">
<meta name="flags" content="may interact">
<meta name="assert" content="Test checks that computed style of caret-color on visited links doesn't leak privacy information.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  a {
    font-size: 3em;
    font-weight: bold;
    width: 10em;
    padding: 10px;
    background: black; /* the color of a thin object like the caret is easier to see on a black background. */

    color: white;
    caret-color: lime;
  }

  a:link {
    color: yellow;
  }

  a:visited {
    caret-color: cyan;
  }
</style>
<body>
  <p>Before running this test, this <a href="./">link</a> must have been visited. It will have yellow text if this is not the case. If it its text is yellow, you need to navigate to this link first.
  <p><a id="link" contenteditable href="./">link</a></p>
  <div id=log></div>

  <script>
    setup(
      function(){
        /* Helper to get the link into the browsing history.
           Using a relative path because some browsers only allow replaceState within the same domain. */
        current_url = window.location.href;
        history.replaceState({},"","./");
        history.replaceState({},"",current_url);
      });

    test(
      function(){
        var link = document.getElementById("link");
        assert_equals(window.getComputedStyle(link)["caret-color"], "rgb(0, 255, 0)");
    }, "The computed value of a visited link should be the same than a non-visited link");
  </script>
</body>