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

Unified Diff: LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js

Issue 709193003: Don't require getPropertyCSSValue in css3-text getComputedStyle tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js
diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js
index 73363eaa60228839c15d8cc162e15c0d37b68064..9c97358dabfd6bfc688978d849c928669ae297b1 100644
--- a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js
+++ b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js
@@ -1,22 +1,14 @@
-function testElementStyle(propertyJS, propertyCSS, type, value)
-{
- if (type != null) {
- shouldBe("e.style." + propertyJS, "'" + value + "'");
- shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()", "'" + type + "'");
- shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
- } else
- shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')");
-}
-
-function testComputedStyle(propertyJS, propertyCSS, type, value)
+function test(value, inlineValue, computedValue)
{
+ if (value !== null)
+ e.style.textUnderlinePosition = value;
+ shouldBeEqualToString("e.style.textUnderlinePosition", inlineValue);
computedStyle = window.getComputedStyle(e, null);
- shouldBe("computedStyle." + propertyJS, "'" + value + "'");
- shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString()", "'" + type + "'");
- shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
+ shouldBeEqualToString("computedStyle.textUnderlinePosition", computedValue);
+ debug('');
}
-description("Test to make sure text-underline-position property returns values properly.")
+description("Test to make sure text-underline-position is computed properly.")
// FIXME: This test tests property values 'auto' and 'under'. We don't fully match
// the specification as we don't support [ left | right ] and this is left for another implementation
@@ -30,54 +22,32 @@ testContainer.innerHTML = '<div id="test">hello world</div>';
debug("Initial value:");
e = document.getElementById('test');
-testElementStyle("textUnderlinePosition", "text-underline-position", null, '');
-testComputedStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "auto");
-debug('');
+test(null, "", "auto");
debug("Value '':");
-e.style.textUnderlinePosition = '';
-testElementStyle("textUnderlinePosition", "text-underline-position", null, '');
-testComputedStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "auto");
-debug('');
+test("", "", "auto");
debug("Initial value (explicit):");
-e.style.textUnderlinePosition = 'initial';
-testElementStyle("textUnderlinePosition", "text-underline-position", "[object CSSValue]", "initial");
-testComputedStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "auto");
-debug('');
+test("initial", "initial", "auto");
debug("Value 'auto':");
-e.style.textUnderlinePosition = 'auto';
-testElementStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "auto");
-testComputedStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "auto");
-debug('');
+test("auto", "auto", "auto");
debug("Value 'under':");
-e.style.textUnderlinePosition = 'under';
-testElementStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "under");
-testComputedStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "under");
-debug('');
+test("under", "under", "under");
testContainer.innerHTML = '<div id="test-parent" style="text-underline-position: under;">hello <span id="test-ancestor">world</span></div>';
debug("Ancestor inherits values from parent:");
e = document.getElementById('test-ancestor');
-testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
-testComputedStyle("textUnderlinePosition", "text-underline-position", "[object CSSPrimitiveValue]", "under");
-debug('');
+test(null, "", "under");
debug("Value 'auto under':");
-e.style.textUnderlinePosition = 'auto under';
-testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
-debug('');
+test("auto under", "", "under");
debug("Value 'under under':");
-e.style.textUnderlinePosition = 'under under';
-testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
-debug('');
+test("under under", "", "under");
-debug("Value 'under under under':");
-e.style.textUnderlinePosition = 'auto alphabetic under';
-testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
-debug('');
+debug("Value 'auto alphabetic under':");
+test("auto alphabetic under", "", "under");
document.body.removeChild(testContainer);

Powered by Google App Engine
This is Rietveld 408576698