36bd93ddd8ae2070c310ff4dc582ed32b4fac2cf
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / css / getComputedStyle / script-tests / getComputedStyle-text-decoration.js
1 function testComputedStyle(propertyJS, value)
2 {
3     computedStyle = window.getComputedStyle(e, null);
4     shouldBe("computedStyle." + propertyJS, "'" + value + "'");
5 }
6
7 description("Test to make sure text-decoration property returns values properly.")
8
9 var testContainer = document.createElement("div");
10 testContainer.contentEditable = true;
11 document.body.appendChild(testContainer);
12
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)");
17 debug('');
18
19 debug("Initial value (explicit):");
20 e.style.textDecoration = 'initial';
21 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
22 debug('');
23
24 debug("Value 'none':");
25 e.style.textDecoration = 'none';
26 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
27 debug('');
28
29 debug("Value 'underline':");
30 e.style.textDecoration = 'underline';
31 testComputedStyle("textDecoration", "underline solid rgb(0, 0, 0)");
32 debug('');
33
34 debug("Value 'overline':");
35 e.style.textDecoration = 'overline';
36 testComputedStyle("textDecoration", "overline solid rgb(0, 0, 0)");
37 debug('');
38
39 debug("Value 'line-through':");
40 e.style.textDecoration = 'line-through';
41 testComputedStyle("textDecoration", "line-through solid rgb(0, 0, 0)");
42 debug('');
43
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)");
47 debug('');
48
49 debug("Value 'blink' (valid but ignored):");
50 e.style.textDecoration = 'blink';
51 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
52 debug('');
53
54 debug("Value '':");
55 e.style.textDecoration = '';
56 testComputedStyle("textDecoration", "none solid rgb(0, 0, 0)");
57 debug('');
58
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)");
63 debug('');
64
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)");
68 debug('');
69
70 debug("Ancestor should not implicitly inherit value from parent (i.e. when value is void):");
71 e.style.textDecoration = '';
72 testComputedStyle("textDecoration", "none");
73 debug('');
74
75 document.body.removeChild(testContainer);