1 function testComputedStyle(propertyJS, value)
3 computedStyle = window.getComputedStyle(e, null);
4 shouldBe("computedStyle." + propertyJS, "'" + value + "'");
7 description("Test to make sure text-decoration property returns values properly.")
9 var testContainer = document.createElement("div");
10 testContainer.contentEditable = true;
11 document.body.appendChild(testContainer);
13 testContainer.innerHTML = '<div id="test">hello world</div>';
14 debug("Initial value:");
15 e = document.getElementById('test');
16 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
19 debug("Initial value (explicit):");
20 e.style.textDecoration = 'initial';
21 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
24 debug("Value 'none':");
25 e.style.textDecoration = 'none';
26 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
29 debug("Value 'underline':");
30 e.style.textDecoration = 'underline';
31 testComputedStyle("textDecoration", "underline solid rgb(0, 0, 0)");
34 debug("Value 'overline':");
35 e.style.textDecoration = 'overline';
36 testComputedStyle("textDecoration", "overline solid rgb(0, 0, 0)");
39 debug("Value 'line-through':");
40 e.style.textDecoration = 'line-through';
41 testComputedStyle("textDecoration", "line-through solid rgb(0, 0, 0)");
44 debug("Value 'underline overline line-through':");
45 e.style.textDecoration = 'underline overline line-through';
46 testComputedStyle("textDecoration", "underline overline line-through solid rgb(0, 0, 0)");
49 debug("Value 'blink' (valid but ignored):");
50 e.style.textDecoration = 'blink';
51 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
55 e.style.textDecoration = '';
56 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
59 testContainer.innerHTML = '<div id="test-parent" style="text-decoration: underline;">hello <span id="test-ancestor" style="text-decoration: inherit;">world</span></div>';
60 debug("Parent gets 'underline' value:");
61 e = document.getElementById('test-parent');
62 testComputedStyle("textDecoration", "underline solid rgb(0, 0, 0)");
65 debug("Ancestor should explicitly inherit value from parent when 'inherit' value is used:");
66 e = document.getElementById('test-ancestor');
67 testComputedStyle("textDecoration", "underline solid rgb(0, 0, 0)");
70 debug("Ancestor should not implicitly inherit value from parent (i.e. when value is void):");
71 e.style.textDecoration = '';
72 testComputedStyle("textDecoration", "none");
75 document.body.removeChild(testContainer);