Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css3-text / css3-text-justify / getComputedStyle / getComputedStyle-text-justify.html
blobcb4e4db3243bfaab2a3da70d4b3cea5e44a8470f
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <div id="test"></div>
8 <div id="ancestor"><div id="child"></div></div>
10 <script>
11 function testElementStyle(value)
13 shouldBe("element.style.textJustify", "'" + value + "'");
16 function testComputedStyle(value)
18 computedStyle = window.getComputedStyle(element, null);
19 shouldBe("computedStyle.textJustify", "'" + value + "'");
22 function valueSettingTest(value)
24 debug("Value '" + value + "':");
25 element.style.textJustify = value;
26 testElementStyle(value);
27 testComputedStyle(value);
28 debug('');
31 function invalidValueSettingTest(value, presettedValue)
33 debug("Invalid value test - '" + value + "':");
34 element.style.textJustify = value;
35 testElementStyle(presettedValue);
36 testComputedStyle(presettedValue);
37 debug('');
40 function ownValueTest(ancestorValue, childValue)
42 debug("Value of ancestor is '" + ancestorValue + ", while child is '" + childValue + "':");
43 ancestor.style.textJustify = ancestorValue;
44 child.style.textJustify = childValue;
45 testElementStyle(childValue);
46 testComputedStyle(childValue);
47 debug('');
50 function inheritanceTest(ancestorValue)
52 debug("Value of ancestor is '" + ancestorValue + "':");
53 ancestor.style.textJustify = ancestorValue;
54 expectedInheritedValue = ancestorValue;
55 testElementStyle(expectedInheritedValue);
56 testComputedStyle(expectedInheritedValue);
57 debug('');
60 function computedValueSettingTest(value, expectedComputedValue)
62 debug("Computed value test - '" + value + "':");
63 if (value == 'inherit')
64 ancestor.style.textJustify = expectedComputedValue;
65 element.style.textJustify = value;
66 testElementStyle(value);
67 testComputedStyle(expectedComputedValue);
68 debug('');
71 description("This test checks that text-justify parses properly the properties from CSS 3 Text.");
73 element = document.getElementById('test');
75 valueSettingTest('none');
76 valueSettingTest('inter-word');
77 valueSettingTest('distribute');
79 presettedValue = 'none'
80 debug("Presetted value is none");
81 element.style.textJustify = presettedValue;
82 invalidValueSettingTest('green', presettedValue);
83 invalidValueSettingTest('inline', presettedValue);
85 presettedValue = 'distribute'
86 debug("Presetted value is distribute");
87 element.style.textJustify = presettedValue;
88 invalidValueSettingTest('solid', presettedValue);
89 invalidValueSettingTest('normal', presettedValue);
91 element = document.getElementById('child');
92 ancestor = document.getElementById('ancestor');
94 computedValueSettingTest('inherit', 'none');
95 computedValueSettingTest('inherit', 'distribute');
96 computedValueSettingTest('initial', 'auto');
98 ownValueTest("inter-word", "distribute");
99 ownValueTest("none", "inter-word");
100 </script>
101 </body>
103 </html>