Chromium Code Reviews| Index: LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html |
| diff --git a/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e24ac07608036412272ac64076756ce87a381e64 |
| --- /dev/null |
| +++ b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html |
| @@ -0,0 +1,117 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script src="../../../js/resources/js-test-pre.js"></script> |
| +</head> |
| +<body> |
| +<div id="test">hello world</div> |
| +<div id="ancestor"><div id="child">inherit test</div></div> |
| +<script> |
| + function testElementStyle(value) |
| + { |
| + shouldBe("e.style.textJustify", "'" + value + "'"); |
| + shouldBe("e.style.getPropertyCSSValue('text-justify').cssText", "'" + value + "'"); |
| + } |
| + |
| + function testComputedStyle(value) |
| + { |
| + computedStyle = window.getComputedStyle(e, null); |
| + shouldBe("computedStyle.textJustify", "'" + value + "'"); |
| + shouldBe("computedStyle.getPropertyCSSValue('text-justify').cssText", "'" + value + "'"); |
| + } |
| + |
| + function valueSettingTest(value) |
| + { |
| + debug("Value '" + value + "':"); |
| + e.style.textJustify = value; |
| + testElementStyle(value); |
| + testComputedStyle(value); |
| + debug(''); |
| + } |
| + |
| + function invalidValueSettingTest(value, defaultValue) |
|
Julien - ping for review
2013/07/17 01:51:10
Do we really need |defaultValue| as it's always au
dw.im
2013/07/17 02:03:15
hmm... no. we don't.
|
| + { |
| + debug("Invalid value test - '" + value + "':"); |
| + e.style.textJustify = value; |
| + testElementStyle(defaultValue); |
| + testComputedStyle(defaultValue); |
| + debug(''); |
| + } |
| + |
| + function testElementStyle_inherit(value) |
| + { |
| + shouldBe("child.style.textJustify", "'" + value + "'"); |
| + shouldBe("child.style.getPropertyCSSValue('text-justify').cssText", "'" + value + "'"); |
| + } |
| + |
| + function testComputedStyle_inherit(a_value, c_value) |
| + { |
| + shouldBe("window.getComputedStyle(ancestor).getPropertyCSSValue('text-justify').cssText", "'" + a_value + "'"); |
| + shouldBe("window.getComputedStyle(child).getPropertyCSSValue('text-justify').cssText", "'" + c_value + "'"); |
|
Julien - ping for review
2013/07/17 01:51:10
Any reason this doesn't check also test e.style? A
|
| + debug(''); |
| + } |
| + |
| + function ownValueTest(a_value, c_value) |
|
Julien - ping for review
2013/07/17 01:51:10
let's use WebKit style for variable instead of c_s
|
| + { |
| + debug("Value of ancestor is '" + a_value + ", while child is '" + c_value + "':"); |
| + ancestor.style.textJustify = a_value; |
| + child.style.textJustify = c_value; |
| + testComputedStyle_inherit(a_value, c_value); |
| + } |
| + |
| + function inheritanceTest(a_value) |
| + { |
| + debug("Value of ancestor is '" + a_value + "':"); |
| + ancestor.style.textJustify = a_value; |
| + testComputedStyle_inherit(a_value, a_value); |
|
Julien - ping for review
2013/07/17 01:51:10
Why 2 arguments when the function only takes one?
|
| + } |
| + |
| + function computedValueSettingTest(value, defaultValue) |
| + { |
| + debug("Computed value test - '" + value + "':"); |
| + ancestor.style.textJustify = defaultValue; |
| + e.style.textJustify = value; |
| + testElementStyle(value); |
| + testComputedStyle(defaultValue); |
| + debug(''); |
| + } |
| + |
| + description("This test checks that text-justify parses properly the properties from CSS 3 Text."); |
| + |
| + e = document.getElementById('test'); |
| + ancestor = document.getElementById('ancestor'); |
| + child = document.getElementById('child'); |
| + |
| + debug("Test the initial value:"); |
| + testComputedStyle('auto'); |
|
Julien - ping for review
2013/07/17 01:51:10
Why is this only testing getComputedStyle and not
dw.im
2013/07/17 02:03:15
I will add one line of code to test it.
|
| + debug(''); |
| + |
| + valueSettingTest('auto'); |
|
Julien - ping for review
2013/07/17 01:51:10
This tests nothing as your default value is 'auto'
dw.im
2013/07/17 02:03:15
valueSettingTest is set & test,
so, set as 'auto'
Julien - ping for review
2013/07/17 17:35:25
Right, this is what the code does but it is actual
|
| + valueSettingTest('none'); |
| + valueSettingTest('inter-word'); |
| + valueSettingTest('distribute'); |
| + |
| + defaultValue = 'auto' |
| + e.style.textJustify = defaultValue; |
| + invalidValueSettingTest('-webkit-left', defaultValue); |
| + invalidValueSettingTest('-webkit-right', defaultValue); |
|
Julien - ping for review
2013/07/17 01:51:10
Can we avoid undocumented, unstandardized and pref
dw.im
2013/07/17 02:03:15
oh! sure. I will use another one.
I used these val
|
| + invalidValueSettingTest('solid', defaultValue); |
| + invalidValueSettingTest('normal', defaultValue); |
| + |
| + inheritanceTest("auto"); |
| + inheritanceTest("none"); |
| + inheritanceTest("inter-word"); |
| + inheritanceTest("distribute"); |
| + |
| + ownValueTest("inter-word", "distribute"); |
| + ownValueTest("none", "inter-word"); |
| + |
| + e = document.getElementById('child'); |
| + computedValueSettingTest('initial', 'auto'); |
|
Julien - ping for review
2013/07/17 01:51:10
This testing is very much based on the previous on
|
| + computedValueSettingTest('inherit', 'none'); |
| + computedValueSettingTest('inherit', 'distribute'); |
| +</script> |
| +<script src="../../../js/resources/js-test-post.js"></script> |
| +</body> |
| + |
| +</html> |