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

Side by Side Diff: LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-color.js

Issue 14576017: Implement CSS3TextDecorations runtime flag in favor of CSS3_TEXT (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed updated on text-underline-position for now (to be discussed & re-added later) Created 7 years, 7 months 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
1 function testElementStyle(type, value) 1 function testElementStyle(type, value)
2 { 2 {
3 if (type != null) { 3 if (type != null) {
4 shouldBe("e.style.webkitTextDecorationColor", "'" + value + "'"); 4 shouldBe("e.style.textDecorationColor", "'" + value + "'");
5 shouldBe("e.style.getPropertyCSSValue('-webkit-text-decoration-color').t oString()", "'" + type + "'"); 5 shouldBe("e.style.getPropertyCSSValue('text-decoration-color').toString( )", "'" + type + "'");
6 shouldBe("e.style.getPropertyCSSValue('-webkit-text-decoration-color').c ssText", "'" + value + "'"); 6 shouldBe("e.style.getPropertyCSSValue('text-decoration-color').cssText", "'" + value + "'");
7 } else 7 } else
8 shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-color ')"); 8 shouldBeNull("e.style.getPropertyCSSValue('text-decoration-color')");
9 } 9 }
10 10
11 function testComputedStyleValue(type, value) 11 function testComputedStyleValue(type, value)
12 { 12 {
13 computedStyle = window.getComputedStyle(e, null); 13 computedStyle = window.getComputedStyle(e, null);
14 shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-color') .toString()", "'" + type + "'"); 14 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-color').toStrin g()", "'" + type + "'");
15 shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-color') .cssText", "'" + value + "'"); 15 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-color').cssText ", "'" + value + "'");
16 shouldBe("computedStyle.webkitTextDecorationColor", "'" + value + "'"); 16 shouldBe("computedStyle.textDecorationColor", "'" + value + "'");
17 } 17 }
18 18
19 function testValue(value, elementValue, elementStyle, computedValue, computedSty le) 19 function testValue(value, elementValue, elementStyle, computedValue, computedSty le)
20 { 20 {
21 if (value != null) 21 if (value != null)
22 e.style.webkitTextDecorationColor = value; 22 e.style.textDecorationColor = value;
23 testElementStyle(elementStyle, elementValue); 23 testElementStyle(elementStyle, elementValue);
24 testComputedStyleValue(computedStyle, computedValue); 24 testComputedStyleValue(computedStyle, computedValue);
25 debug(''); 25 debug('');
26 } 26 }
27 27
28 description("Test to make sure -webkit-text-decoration-color property returns CS SPrimitiveValue properly.") 28 description("Test to make sure text-decoration-color property returns CSSPrimiti veValue properly.")
29 29
30 var testContainer = document.createElement("div"); 30 var testContainer = document.createElement("div");
31 testContainer.contentEditable = true; 31 testContainer.contentEditable = true;
32 document.body.appendChild(testContainer); 32 document.body.appendChild(testContainer);
33 33
34 testContainer.innerHTML = '<div id="test-parent" style="-webkit-text-decoration- color: green !important;">hello <span id="test-ancestor">world</span></div>'; 34 testContainer.innerHTML = '<div id="test-parent" style="text-decoration-color: g reen !important;">hello <span id="test-ancestor">world</span></div>';
35 debug("Ancestor should not inherit 'green' value from parent (fallback to initia l value):") 35 debug("Ancestor should not inherit 'green' value from parent (fallback to initia l value):")
36 e = document.getElementById('test-ancestor'); 36 e = document.getElementById('test-ancestor');
37 testValue(null, "", null, "rgb(0, 0, 0)", "[object CSSPrimitiveValue]"); 37 testValue(null, "", null, "rgb(0, 0, 0)", "[object CSSPrimitiveValue]");
38 38
39 debug("Parent should contain 'green':"); 39 debug("Parent should contain 'green':");
40 e = document.getElementById('test-parent'); 40 e = document.getElementById('test-parent');
41 testValue(null, "green", "[object CSSPrimitiveValue]", "rgb(0, 128, 0)", "[objec t CSSPrimitiveValue]"); 41 testValue(null, "green", "[object CSSPrimitiveValue]", "rgb(0, 128, 0)", "[objec t CSSPrimitiveValue]");
42 42
43 testContainer.innerHTML = '<div id="test-js">test</div>'; 43 testContainer.innerHTML = '<div id="test-js">test</div>';
44 debug("JavaScript setter tests for valid, initial, invalid and blank values:"); 44 debug("JavaScript setter tests for valid, initial, invalid and blank values:");
45 e = document.getElementById('test-js'); 45 e = document.getElementById('test-js');
46 shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-color')"); 46 shouldBeNull("e.style.getPropertyCSSValue('text-decoration-color')");
47 47
48 debug("\nValid value 'blue':"); 48 debug("\nValid value 'blue':");
49 testValue("blue", "blue", "[object CSSPrimitiveValue]", "rgb(0, 0, 255)", "[obje ct CSSPrimitiveValue]"); 49 testValue("blue", "blue", "[object CSSPrimitiveValue]", "rgb(0, 0, 255)", "[obje ct CSSPrimitiveValue]");
50 50
51 debug("Valid value '#FFFFFF':"); 51 debug("Valid value '#FFFFFF':");
52 testValue("#FFFFFF", "rgb(255, 255, 255)", "[object CSSPrimitiveValue]", "rgb(25 5, 255, 255)", "[object CSSPrimitiveValue]"); 52 testValue("#FFFFFF", "rgb(255, 255, 255)", "[object CSSPrimitiveValue]", "rgb(25 5, 255, 255)", "[object CSSPrimitiveValue]");
53 53
54 debug("Valid value 'rgb(0, 255, 0)':"); 54 debug("Valid value 'rgb(0, 255, 0)':");
55 testValue("rgb(0, 255, 0)", "rgb(0, 255, 0)", "[object CSSPrimitiveValue]", "rgb (0, 255, 0)", "[object CSSPrimitiveValue]"); 55 testValue("rgb(0, 255, 0)", "rgb(0, 255, 0)", "[object CSSPrimitiveValue]", "rgb (0, 255, 0)", "[object CSSPrimitiveValue]");
56 56
(...skipping 13 matching lines...) Expand all
70 testValue("unknown", "initial", "[object CSSValue]", "rgb(0, 0, 0)", "[object CS SPrimitiveValue]"); 70 testValue("unknown", "initial", "[object CSSValue]", "rgb(0, 0, 0)", "[object CS SPrimitiveValue]");
71 71
72 debug("Empty value (resets the property):"); 72 debug("Empty value (resets the property):");
73 testValue("", "", null, "rgb(0, 0, 0)", "[object CSSPrimitiveValue]"); 73 testValue("", "", null, "rgb(0, 0, 0)", "[object CSSPrimitiveValue]");
74 74
75 debug("Empty value with different 'currentColor' initial value (green):") 75 debug("Empty value with different 'currentColor' initial value (green):")
76 e.style.color = 'green'; 76 e.style.color = 'green';
77 testValue("", "", null, "rgb(0, 128, 0)", "[object CSSPrimitiveValue]"); 77 testValue("", "", null, "rgb(0, 128, 0)", "[object CSSPrimitiveValue]");
78 78
79 document.body.removeChild(testContainer); 79 document.body.removeChild(testContainer);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698