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

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

Issue 709193003: Don't require getPropertyCSSValue in css3-text getComputedStyle tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 test(value, inlineValue, computedValue)
2 { 2 {
3 if (type != null) { 3 if (value !== null)
4 shouldBe("e.style.textDecorationStyle", "'" + value + "'"); 4 e.style.textDecorationStyle = value;
5 shouldBe("e.style.getPropertyCSSValue('text-decoration-style').toString( )", "'" + type + "'"); 5 shouldBeEqualToString("e.style.textDecorationStyle", inlineValue);
6 shouldBe("e.style.getPropertyCSSValue('text-decoration-style').cssText", "'" + value + "'"); 6 computedStyle = window.getComputedStyle(e, null);
7 } else 7 shouldBeEqualToString("computedStyle.textDecorationStyle", computedValue);
8 shouldBeNull("e.style.getPropertyCSSValue('text-decoration-style')"); 8 debug("");
9 } 9 }
10 10
11 function testComputedStyleValue(type, value) 11 description("Test to make sure text-decoration-style is computed properly.")
12 {
13 computedStyle = window.getComputedStyle(e, null);
14 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-style').toStrin g()", "'" + type + "'");
15 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-style').cssText ", "'" + value + "'");
16 shouldBe("computedStyle.textDecorationStyle", "'" + value + "'");
17 }
18
19 function testValue(value, elementValue, elementStyle, computedValue, computedSty le)
20 {
21 if (value != null)
22 e.style.textDecorationStyle = value;
23 testElementStyle(elementStyle, elementValue);
24 testComputedStyleValue(computedStyle, computedValue);
25 debug('');
26 }
27
28 description("Test to make sure text-decoration-style property returns CSSPrimiti veValue properly.")
29 12
30 var testContainer = document.createElement("div"); 13 var testContainer = document.createElement("div");
31 testContainer.contentEditable = true; 14 testContainer.contentEditable = true;
32 document.body.appendChild(testContainer); 15 document.body.appendChild(testContainer);
33 16
34 testContainer.innerHTML = '<div id="test-parent" style="text-decoration-style: d ashed !important;">hello <span id="test-ancestor">world</span></div>'; 17 testContainer.innerHTML = '<div id="test-parent" style="text-decoration-style: d ashed !important;">hello <span id="test-ancestor">world</span></div>';
35 debug("Ancestor should not inherit 'dashed' value from parent (fallback to initi al 'solid' value):") 18 debug("Ancestor should not inherit 'dashed' value from parent (fallback to initi al 'solid' value):")
36 e = document.getElementById('test-ancestor'); 19 e = document.getElementById('test-ancestor');
37 testValue(null, "", null, "solid", "[object CSSPrimitiveValue]"); 20 test(null, "", "solid");
38 21
39 debug("Parent should cointain 'dashed':"); 22 debug("Parent should cointain 'dashed':");
40 e = document.getElementById('test-parent'); 23 e = document.getElementById('test-parent');
41 testValue(null, "dashed", "[object CSSPrimitiveValue]", "dashed", "[object CSSPr imitiveValue]"); 24 test(null, "dashed", "dashed");
42 25
43 testContainer.innerHTML = '<div id="test-js">test</div>'; 26 testContainer.innerHTML = '<div id="test-js">test</div>';
44 debug("JavaScript setter tests for valid, initial, invalid and blank values:"); 27 debug("JavaScript setter tests for valid, initial, invalid and blank values:");
45 e = document.getElementById('test-js'); 28 e = document.getElementById('test-js');
46 shouldBeNull("e.style.getPropertyCSSValue('text-decoration-style')"); 29 shouldBeEmptyString("e.style.textDecorationStyle");
47 30
48 debug("\nValid value 'solid':"); 31 debug("\nValid value 'solid':");
49 testValue("solid", "solid", "[object CSSPrimitiveValue]", "solid", "[object CSSP rimitiveValue]"); 32 test("solid", "solid", "solid");
50 33
51 debug("Valid value 'double':"); 34 debug("Valid value 'double':");
52 testValue("double", "double", "[object CSSPrimitiveValue]", "double", "[object C SSPrimitiveValue]"); 35 test("double", "double", "double");
53 36
54 debug("Valid value 'dotted':"); 37 debug("Valid value 'dotted':");
55 testValue("dotted", "dotted", "[object CSSPrimitiveValue]", "dotted", "[object C SSPrimitiveValue]"); 38 test("dotted", "dotted", "dotted");
56 39
57 debug("Valid value 'dashed':"); 40 debug("Valid value 'dashed':");
58 testValue("dashed", "dashed", "[object CSSPrimitiveValue]", "dashed", "[object C SSPrimitiveValue]"); 41 test("dashed", "dashed", "dashed");
59 42
60 debug("Valid value 'wavy':"); 43 debug("Valid value 'wavy':");
61 testValue("wavy", "wavy", "[object CSSPrimitiveValue]", "wavy", "[object CSSPrim itiveValue]"); 44 test("wavy", "wavy", "wavy");
62 45
63 debug("Initial value:"); 46 debug("Initial value:");
64 testValue("initial", "initial", "[object CSSValue]", "solid", "[object CSSPrimit iveValue]"); 47 test("initial", "initial", "solid");
65 48
66 debug("Invalid value (this property accepts one value at a time only):"); 49 debug("Invalid value (this property accepts one value at a time only):");
67 testValue("double dotted", "initial", "[object CSSValue]", "solid", "[object CSS PrimitiveValue]"); 50 test("double dotted", "initial", "solid");
68 51
69 debug("Invalid value (ie. 'unknown'):"); 52 debug("Invalid value (ie. 'unknown'):");
70 testValue("unknown", "initial", "[object CSSValue]", "solid", "[object CSSPrimit iveValue]"); 53 test("unknown", "initial", "solid");
71 54
72 debug("Empty value (resets the property):"); 55 debug("Empty value (resets the property):");
73 testValue("", "", null, "solid", "[object CSSPrimitiveValue]"); 56 test("", "", "solid");
74 57
75 document.body.removeChild(testContainer); 58 document.body.removeChild(testContainer);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698