Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/csswg-test/css-ui-3/caret-color-013.html

Issue 2539753002: [css-ui] Import W3C Test Suite (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <title>CSS Basic User Interface Test: caret-color dynamic changes</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 <meta name="flags" content="dom">
8 <meta name="assert" content="Test checks checks that carret-color can be correct ly changed using the style attribute, and that the computed value is done correc tly.">
9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script>
11
12 <div id="log"></div>
13 <div id="wrapper">
14 <textarea id="textarea"></textarea>
15 </div>
16
17 <script>
18 function testStyleCaretColor(element, value) {
19 assert_equals(element.style.caretColor, value, "The style attribute's caret- color should be '" + value + "'");
20 }
21
22 function testComputedStyleCaretColor(element, value) {
23 assert_equals(getComputedStyle(element).getPropertyValue("caret-color"), val ue, "caret-color computed style should be '" + value + "'");
24 }
25
26 function setAndCheckCaretColor(element, caretColor, styleValue, computedStyleV alue, description) {
27 element.style.caretColor = caretColor;
28 test(function() {
29 testStyleCaretColor(element, styleValue);
30 testComputedStyleCaretColor(element, computedStyleValue);
31 }, description);
32 }
33
34 var textarea = document.getElementById("textarea");
35 setAndCheckCaretColor(textarea, "", "", "auto", "Test default caret-color");
36 setAndCheckCaretColor(textarea, "initial", "initial", "auto", "Test caret-colo r: initial");
37 setAndCheckCaretColor(textarea, "inherit", "inherit", "auto", "Test caret-colo r: inherit");
38 setAndCheckCaretColor(textarea, "auto", "auto", "auto", "Test caret-color: aut o");
39 setAndCheckCaretColor(textarea, "currentcolor", "currentcolor", "currentcolor" , "Test caret-color: currentcolor");
40 setAndCheckCaretColor(textarea, "lime", "lime", "rgb(0, 255, 0)", "Test caret- color: lime");
41 setAndCheckCaretColor(textarea, "initial", "initial", "auto", "Reset caret-col or: initial");
42 setAndCheckCaretColor(textarea, "rgb(0, 100, 100)", "rgb(0, 100, 100)", "rgb(0 , 100, 100)", "Test caret-color: rgb(0, 100, 100)");
43
44 var wrapper = document.getElementById("wrapper");
45 wrapper.style.caretColor = "green";
46
47 setAndCheckCaretColor(textarea, "initial", "initial", "auto", "Test caret-colo r: initial (inherited)");
48 setAndCheckCaretColor(textarea, "inherit", "inherit", "rgb(0, 128, 0)", "Test caret-color: inherit (inherited)");
49 setAndCheckCaretColor(textarea, "blue", "blue", "rgb(0, 0, 255)", "Test caret- color: blue (inherited)");
50 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698