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..903bbf5f48459d3d756fa2246b5327ff97787e6d |
| --- /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.textJustify = value; |
| + testElementStyle("textJustify", "text-justify", "[object CSSPrimitiveValue]", value); |
| + testComputedStyle("textJustify", "text-justify", "[object CSSPrimitiveValue]", value); |
| + debug(''); |
| +} |
| + |
| +function invalidValueSettingTest(value, defaultValue) |
| +{ |
| + debug("Invalid value test - '" + value + "':"); |
| + e.style.textJustify = value; |
| + testElementStyle("textJustify", "text-justify", "[object CSSPrimitiveValue]", defaultValue); |
| + testComputedStyle("textJustify", "text-justify", "[object CSSPrimitiveValue]", defaultValue); |
| + debug(''); |
| +} |
| + |
| +function computedValueSettingTest(value, defaultValue) |
|
Julien - ping for review
2013/07/15 22:05:47
This function is testing nothing if defaultValue =
dw.im
2013/07/16 01:13:56
I see.
I'll try it with another value.
|
| +{ |
| + debug("Computed value test - '" + value + "':"); |
| + e.style.textJustify = value; |
| + testElementStyle("textJustify", "text-justify", "[object CSSPrimitiveValue]", value); |
| + testComputedStyle("textJustify", "text-justify", "[object CSSPrimitiveValue]", defaultValue); |
| + debug(''); |
| +} |
| + |
| +description("This test checks that text-justify parses properly the properties from CSS 3 Text."); |
| + |
| +e = document.getElementById('test'); |
| + |
| +debug("Test the initial value:"); |
| +testComputedStyle("textJustify", "text-justify", "[object CSSPrimitiveValue]", 'auto'); |
| +debug(''); |
| + |
| +valueSettingTest('auto'); |
| +valueSettingTest('none'); |
| +valueSettingTest('inter-word'); |
| +valueSettingTest('distribute'); |
| + |
| +defaultValue = 'auto' |
| +e.style.textJustify = 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'); |