Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit ab2484f

Browse files
authored
Merge pull request #1152 from mrego/caret-color-new-tests
[css-ui] Add new tests for caret-color property
2 parents 73e6051 + a4bd1a5 commit ab2484f

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

css-ui-3/caret-color-016.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS Basic User Interface Test: caret-color visited link computed value</title>
4+
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
5+
<link rel="help" href="http://www.w3.org/TR/css3-ui/#caret-color">
6+
<link rel="help" href="https://www.w3.org/TR/css3-color/#color0">
7+
<link rel="help" href="https://www.w3.org/TR/selectors4/#link">
8+
<meta name="flags" content="may interact">
9+
<meta name="assert" content="Test checks that computed style of caret-color on visited links doesn't leak privacy information.">
10+
<script src="/resources/testharness.js"></script>
11+
<script src="/resources/testharnessreport.js"></script>
12+
<style>
13+
a {
14+
font-size: 3em;
15+
font-weight: bold;
16+
width: 10em;
17+
padding: 10px;
18+
background: black; /* the color of a thin object like the caret is easier to see on a black background. */
19+
20+
color: white;
21+
caret-color: lime;
22+
}
23+
24+
a:link {
25+
color: yellow;
26+
}
27+
28+
a:visited {
29+
caret-color: cyan;
30+
}
31+
</style>
32+
<body>
33+
<p>Before running this test, the link below 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.
34+
<p><a id="link" contenteditable href="caret-color-016.html">link</a></p>
35+
<div id=log></div>
36+
37+
<script>
38+
test(
39+
function(){
40+
var link = document.getElementById("link");
41+
assert_equals(window.getComputedStyle(link)["caret-color"], "rgb(0, 255, 0)");
42+
}, "The computed value of a visited link should be the same than a non-visited link");
43+
</script>
44+
</body>

css-ui-3/caret-color-017.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS Basic User Interface Test: caret-color transition</title>
4+
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
5+
<link rel="help" href="http://www.w3.org/TR/css3-ui/#caret-color">
6+
<link rel="help" href="https://www.w3.org/TR/css3-transitions/#transition">
7+
<meta name="flags" content="interact">
8+
<meta name="assert" content="Test checks that caret-color can be used in a transition">
9+
<style>
10+
textarea {
11+
font-size: 3em;
12+
font-weight: bold;
13+
width: 10em;
14+
padding: 10px;
15+
background: black; color: white; /* the color of a thin object like the caret is easier to see on a black background. */
16+
17+
caret-color: magenta;
18+
transition: caret-color 5s;
19+
}
20+
21+
textarea:focus {
22+
caret-color: lime;
23+
}
24+
</style>
25+
<body>
26+
<p>Test passes if, when the text area below is focused for editing, the text insertion caret color gradually changes from magenta to green.</p>
27+
<p>The shape of the caret, and whether it flashes, are not part of the test.</p>
28+
<textarea></textarea>
29+
</body>

0 commit comments

Comments
 (0)