Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html

Issue 17155007: [CSS3] Parsing the property, text-justify. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@parsingTextJustify
Patch Set: Patch for landing Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..7fe1e12cf2e825df120caf70636693737dca6596
--- /dev/null
+++ b/LayoutTests/fast/css3-text/css3-text-justify/getComputedStyle/getComputedStyle-text-justify.html
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="test"></div>
+<div id="ancestor"><div id="child"></div></div>
+
+<script>
+ function testElementStyle(value)
+ {
+ shouldBe("element.style.textJustify", "'" + value + "'");
+ shouldBe("element.style.getPropertyCSSValue('text-justify').cssText", "'" + value + "'");
+ }
+
+ function testComputedStyle(value)
+ {
+ computedStyle = window.getComputedStyle(element, null);
+ shouldBe("computedStyle.textJustify", "'" + value + "'");
+ shouldBe("computedStyle.getPropertyCSSValue('text-justify').cssText", "'" + value + "'");
+ }
+
+ function valueSettingTest(value)
+ {
+ debug("Value '" + value + "':");
+ element.style.textJustify = value;
+ testElementStyle(value);
+ testComputedStyle(value);
+ debug('');
+ }
+
+ function invalidValueSettingTest(value, presettedValue)
+ {
+ debug("Invalid value test - '" + value + "':");
+ element.style.textJustify = value;
+ testElementStyle(presettedValue);
+ testComputedStyle(presettedValue);
+ debug('');
+ }
+
+ function ownValueTest(ancestorValue, childValue)
+ {
+ debug("Value of ancestor is '" + ancestorValue + ", while child is '" + childValue + "':");
+ ancestor.style.textJustify = ancestorValue;
+ child.style.textJustify = childValue;
+ testElementStyle(childValue);
+ testComputedStyle(childValue);
+ debug('');
+ }
+
+ function inheritanceTest(ancestorValue)
+ {
+ debug("Value of ancestor is '" + ancestorValue + "':");
+ ancestor.style.textJustify = ancestorValue;
+ expectedInheritedValue = ancestorValue;
+ testElementStyle(expectedInheritedValue);
+ testComputedStyle(expectedInheritedValue);
+ debug('');
+ }
+
+ function computedValueSettingTest(value, expectedComputedValue)
+ {
+ debug("Computed value test - '" + value + "':");
+ if (value == 'inherit')
+ ancestor.style.textJustify = expectedComputedValue;
+ element.style.textJustify = value;
+ testElementStyle(value);
+ testComputedStyle(expectedComputedValue);
+ debug('');
+ }
+
+ description("This test checks that text-justify parses properly the properties from CSS 3 Text.");
+
+ element = document.getElementById('test');
+
+ valueSettingTest('none');
+ valueSettingTest('inter-word');
+ valueSettingTest('distribute');
+
+ presettedValue = 'none'
+ debug("Presetted value is none");
+ element.style.textJustify = presettedValue;
+ invalidValueSettingTest('green', presettedValue);
+ invalidValueSettingTest('inline', presettedValue);
+
+ presettedValue = 'distribute'
+ debug("Presetted value is distribute");
+ element.style.textJustify = presettedValue;
+ invalidValueSettingTest('solid', presettedValue);
+ invalidValueSettingTest('normal', presettedValue);
+
+ element = document.getElementById('child');
+ ancestor = document.getElementById('ancestor');
+
+ computedValueSettingTest('inherit', 'none');
+ computedValueSettingTest('inherit', 'distribute');
+ computedValueSettingTest('initial', 'auto');
+
+ ownValueTest("inter-word", "distribute");
+ ownValueTest("none", "inter-word");
+</script>
+<script src="../../../js/resources/js-test-post.js"></script>
+</body>
+
+</html>

Powered by Google App Engine
This is Rietveld 408576698