Chromium Code Reviews| Index: LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js |
| diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..79f77741c5c15ec413b43b5e934c13b2938ada5c |
| --- /dev/null |
| +++ b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/script-tests/getComputedStyle-text-justify.js |
| @@ -0,0 +1,68 @@ |
| +function testElementStyle(propertyJS, propertyCSS, type, value) |
| +{ |
| + shouldBe("e.style." + propertyJS, "'" + value + "'"); |
| + shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'"); |
| +} |
| + |
| +function testComputedStyle(propertyJS, propertyCSS, type, value) |
| +{ |
| + computedStyle = window.getComputedStyle(e, null); |
| + shouldBe("computedStyle." + propertyJS, "'" + value + "'"); |
| + shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'"); |
| +} |
| + |
| +function valueSettingTest(value) |
| +{ |
| + debug("Value '" + value + "':"); |
| + e.style.webkitTextJustify = value; |
| + testElementStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", value); |
| + testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", value); |
| + debug(''); |
| +} |
| + |
| +function invalidValueSettingTest(value, defaultValue) |
| +{ |
| + debug("Invalid value test - '" + value + "':"); |
| + e.style.webkitTextJustify = value; |
| + testElementStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", defaultValue); |
| + testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", defaultValue); |
| + debug(''); |
| +} |
| + |
| +function computedValueSettingTest(value, defaultValue) |
| +{ |
| + debug("Computed value test - '" + value + "':"); |
| + e.style.webkitTextJustify = value; |
| + testElementStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", value); |
| + testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", defaultValue); |
| + debug(''); |
| +} |
| + |
| +description("This test checks that -webkit-text-justify parses properly the properties from CSS 3 Text."); |
| + |
| +e = document.getElementById('test'); |
| + |
| +debug("Test the initial value:"); |
| +testComputedStyle("webkitTextJustify", "-webkit-text-justify", "[object CSSPrimitiveValue]", 'auto'); |
| +debug(''); |
|
pdr.
2013/06/18 13:06:21
Are these empty debug lines needed?
|
| + |
| +valueSettingTest('auto'); |
| +valueSettingTest('none'); |
| +valueSettingTest('inter-word'); |
| +valueSettingTest('distribute'); |
| + |
| +defaultValue = 'auto' |
| +e.style.webkitTextJustify = defaultValue; |
| +invalidValueSettingTest('-webkit-left', defaultValue); |
| +invalidValueSettingTest('-webkit-right', defaultValue); |
| +invalidValueSettingTest('-webkit-center', defaultValue); |
| +invalidValueSettingTest('-webkit-match-parent', defaultValue); |
| +invalidValueSettingTest('-webkit-auto', defaultValue); |
| +invalidValueSettingTest('solid', defaultValue); |
| +invalidValueSettingTest('normal', defaultValue); |
| +invalidValueSettingTest('bold', defaultValue); |
| +invalidValueSettingTest('background', defaultValue); |
| +invalidValueSettingTest('ltr', defaultValue); |
| + |
| +computedValueSettingTest('inherit', 'auto'); |
| +computedValueSettingTest('initial', 'auto'); |