1function testElementStyle(propertyJS, propertyCSS, type, value)
2{
3 if (type != null) {
4 shouldBe("e.style." + propertyJS, "'" + value + "'");
5 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()", "'" + type + "'");
6 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
7 } else
8 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')");
9}
10
11function testComputedStyle(propertyJS, propertyCSS, type, value)
12{
13 computedStyle = window.getComputedStyle(e, null);
14 shouldBe("computedStyle." + propertyJS, "'" + value + "'");
15 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString()", "'" + type + "'");
16 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
17}
18
19description("Test to make sure -webkit-text-decoration-skip property returns values properly.")
20
21var testContainer = document.createElement("div");
22testContainer.contentEditable = true;
23document.body.appendChild(testContainer);
24
25testContainer.innerHTML = '<div id="test">hello world</div>';
26debug("Initial value:");
27e = document.getElementById('test');
28testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", null, '');
29testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects");
30debug('');
31
32debug("Value '':");
33e.style.webkitTextDecorationSkip = '';
34testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", null, '');
35testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects");
36debug('');
37
38debug("Initial value (explicit):");
39e.style.webkitTextDecorationSkip = 'initial';
40testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValue]", "initial");
41testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects");
42debug('');
43
44debug("Value 'none':");
45e.style.webkitTextDecorationSkip = 'none';
46testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSPrimitiveValue]", "none");
47testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSPrimitiveValue]", "none");
48debug('');
49
50debug("Value 'objects':");
51e.style.webkitTextDecorationSkip = 'objects';
52testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects");
53testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects");
54debug('');
55
56debug("Value 'spaces':");
57e.style.webkitTextDecorationSkip = 'spaces';
58testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "spaces");
59testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "spaces");
60debug('');
61
62debug("Value 'ink':");
63e.style.webkitTextDecorationSkip = 'ink';
64testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "ink");
65testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "ink");
66debug('');
67
68debug("Value 'edges':");
69e.style.webkitTextDecorationSkip = 'edges';
70testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "edges");
71testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "edges");
72debug('');
73
74debug("Value 'objects spaces ink edges':");
75e.style.webkitTextDecorationSkip = 'objects spaces ink edges';
76testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects spaces ink edges");
77testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects spaces ink edges");
78debug('');
79
80testContainer.innerHTML = '<div id="test-parent" style="-webkit-text-decoration-skip: objects spaces ink edges;">hello <span id="test-ancestor">world</span></div>';
81debug("Ancestor inherits values from parent:");
82e = document.getElementById('test-ancestor');
83testElementStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", null, "");
84testComputedStyle("webkitTextDecorationSkip", "-webkit-text-decoration-skip", "[object CSSValueList]", "objects spaces ink edges");
85debug('');
86
87document.body.removeChild(testContainer);