4 <script src=
"../../../../resources/js-test.js"></script>
8 <div id=
"ancestor"><div id=
"child"></div></div>
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
);
31 function invalidValueSettingTest(value
, presettedValue
)
33 debug("Invalid value test - '" + value
+ "':");
34 element
.style
.textJustify
= value
;
35 testElementStyle(presettedValue
);
36 testComputedStyle(presettedValue
);
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
);
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
);
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
);
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");