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

Side by Side Diff: LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-line.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(propertyJS, propertyCSS, type, value) 1 function testElementStyle(propertyJS, propertyCSS, type, value)
2 { 2 {
3 if (type != null) { 3 if (type != null) {
4 shouldBe("e.style." + propertyJS, "'" + value + "'"); 4 shouldBe("e.style." + propertyJS, "'" + value + "'");
5 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()" , "'" + type + "'"); 5 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()" , "'" + type + "'");
6 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", " '" + value + "'"); 6 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", " '" + value + "'");
7 } else 7 } else
8 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')"); 8 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')");
9 } 9 }
10 10
11 function testComputedStyle(propertyJS, propertyCSS, type, value) 11 function testComputedStyle(propertyJS, propertyCSS, type, value)
12 { 12 {
13 computedStyle = window.getComputedStyle(e, null); 13 computedStyle = window.getComputedStyle(e, null);
14 shouldBe("computedStyle." + propertyJS, "'" + value + "'"); 14 shouldBe("computedStyle." + propertyJS, "'" + value + "'");
15 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString( )", "'" + type + "'"); 15 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString( )", "'" + type + "'");
16 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'"); 16 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
17 } 17 }
18 18
19 description("Test to make sure -webkit-text-decoration-line property returns val ues properly.") 19 description("Test to make sure text-decoration-line property returns values prop erly.")
20 20
21 var testContainer = document.createElement("div"); 21 var testContainer = document.createElement("div");
22 testContainer.contentEditable = true; 22 testContainer.contentEditable = true;
23 document.body.appendChild(testContainer); 23 document.body.appendChild(testContainer);
24 24
25 testContainer.innerHTML = '<div id="test">hello world</div>'; 25 testContainer.innerHTML = '<div id="test">hello world</div>';
26 debug("Initial value:"); 26 debug("Initial value:");
27 e = document.getElementById('test'); 27 e = document.getElementById('test');
28 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", nul l, ''); 28 testElementStyle("textDecorationLine", "text-decoration-line", null, '');
29 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSPrimitiveValue]", "none"); 29 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSPrim itiveValue]", "none");
30 debug(''); 30 debug('');
31 31
32 debug("Initial value (explicit):"); 32 debug("Initial value (explicit):");
33 e.style.webkitTextDecorationLine = 'initial'; 33 e.style.textDecorationLine = 'initial';
34 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValue]", "initial"); 34 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue ]", "initial");
35 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSPrimitiveValue]", "none"); 35 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSPrim itiveValue]", "none");
36 debug(''); 36 debug('');
37 37
38 debug("Value 'none':"); 38 debug("Value 'none':");
39 e.style.webkitTextDecorationLine = 'none'; 39 e.style.textDecorationLine = 'none';
40 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSPrimitiveValue]", "none"); 40 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSPrimi tiveValue]", "none");
41 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSPrimitiveValue]", "none"); 41 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSPrim itiveValue]", "none");
42 debug(''); 42 debug('');
43 43
44 debug("Value 'underline':"); 44 debug("Value 'underline':");
45 e.style.webkitTextDecorationLine = 'underline'; 45 e.style.textDecorationLine = 'underline';
46 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValueList]", "underline"); 46 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue List]", "underline");
47 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSValueList]", "underline"); 47 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSValu eList]", "underline");
48 debug(''); 48 debug('');
49 49
50 debug("Value 'overline':"); 50 debug("Value 'overline':");
51 e.style.webkitTextDecorationLine = 'overline'; 51 e.style.textDecorationLine = 'overline';
52 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValueList]", "overline"); 52 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue List]", "overline");
53 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSValueList]", "overline"); 53 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSValu eList]", "overline");
54 debug(''); 54 debug('');
55 55
56 debug("Value 'line-through':"); 56 debug("Value 'line-through':");
57 e.style.webkitTextDecorationLine = 'line-through'; 57 e.style.textDecorationLine = 'line-through';
58 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValueList]", "line-through"); 58 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue List]", "line-through");
59 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSValueList]", "line-through"); 59 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSValu eList]", "line-through");
60 debug(''); 60 debug('');
61 61
62 debug("Value 'underline overline line-through':"); 62 debug("Value 'underline overline line-through':");
63 e.style.webkitTextDecorationLine = 'underline overline line-through'; 63 e.style.textDecorationLine = 'underline overline line-through';
64 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValueList]", "underline overline line-through"); 64 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue List]", "underline overline line-through");
65 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSValueList]", "underline overline line-through"); 65 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSValu eList]", "underline overline line-through");
66 debug(''); 66 debug('');
67 67
68 debug("Value 'blink' (invalid, last valid value is used):"); 68 debug("Value 'blink' (invalid, last valid value is used):");
69 e.style.webkitTextDecorationLine = 'blink'; 69 e.style.textDecorationLine = 'blink';
70 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValueList]", "underline overline line-through"); 70 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue List]", "underline overline line-through");
71 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSValueList]", "underline overline line-through"); 71 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSValu eList]", "underline overline line-through");
72 debug(''); 72 debug('');
73 73
74 debug("Value '':"); 74 debug("Value '':");
75 e.style.webkitTextDecorationLine = ''; 75 e.style.textDecorationLine = '';
76 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", nul l, ''); 76 testElementStyle("textDecorationLine", "text-decoration-line", null, '');
77 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSPrimitiveValue]", "none"); 77 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSPrim itiveValue]", "none");
78 debug(''); 78 debug('');
79 79
80 testContainer.innerHTML = '<div id="test-parent" style="-webkit-text-decoration- line: underline;">hello <span id="test-ancestor" style="-webkit-text-decoration- line: inherit;">world</span></div>'; 80 testContainer.innerHTML = '<div id="test-parent" style="text-decoration-line: un derline;">hello <span id="test-ancestor" style="text-decoration-line: inherit;"> world</span></div>';
81 debug("Parent gets 'underline' value:"); 81 debug("Parent gets 'underline' value:");
82 e = document.getElementById('test-parent'); 82 e = document.getElementById('test-parent');
83 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValueList]", "underline"); 83 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue List]", "underline");
84 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSValueList]", "underline"); 84 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSValu eList]", "underline");
85 debug(''); 85 debug('');
86 86
87 debug("Ancestor should explicitly inherit value from parent when 'inherit' value is used:"); 87 debug("Ancestor should explicitly inherit value from parent when 'inherit' value is used:");
88 e = document.getElementById('test-ancestor'); 88 e = document.getElementById('test-ancestor');
89 testElementStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[o bject CSSValue]", "inherit"); 89 testElementStyle("textDecorationLine", "text-decoration-line", "[object CSSValue ]", "inherit");
90 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "[ object CSSValueList]", "underline"); 90 testComputedStyle("textDecorationLine", "text-decoration-line", "[object CSSValu eList]", "underline");
91 debug(''); 91 debug('');
92 92
93 document.body.removeChild(testContainer); 93 document.body.removeChild(testContainer);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698