Index: LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-style.js |
diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-style.js b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-style.js |
index 72333340219e7c5290ace82403c12e720c19a46d..20c1710f4fec1ab47b2a145b656022bbb32886d2 100644 |
--- a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-style.js |
+++ b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-style.js |
@@ -1,31 +1,14 @@ |
-function testElementStyle(type, value) |
+function test(value, inlineValue, computedValue) |
{ |
- if (type != null) { |
- shouldBe("e.style.textDecorationStyle", "'" + value + "'"); |
- shouldBe("e.style.getPropertyCSSValue('text-decoration-style').toString()", "'" + type + "'"); |
- shouldBe("e.style.getPropertyCSSValue('text-decoration-style').cssText", "'" + value + "'"); |
- } else |
- shouldBeNull("e.style.getPropertyCSSValue('text-decoration-style')"); |
-} |
- |
-function testComputedStyleValue(type, value) |
-{ |
- computedStyle = window.getComputedStyle(e, null); |
- shouldBe("computedStyle.getPropertyCSSValue('text-decoration-style').toString()", "'" + type + "'"); |
- shouldBe("computedStyle.getPropertyCSSValue('text-decoration-style').cssText", "'" + value + "'"); |
- shouldBe("computedStyle.textDecorationStyle", "'" + value + "'"); |
-} |
- |
-function testValue(value, elementValue, elementStyle, computedValue, computedStyle) |
-{ |
- if (value != null) |
+ if (value !== null) |
e.style.textDecorationStyle = value; |
- testElementStyle(elementStyle, elementValue); |
- testComputedStyleValue(computedStyle, computedValue); |
- debug(''); |
+ shouldBeEqualToString("e.style.textDecorationStyle", inlineValue); |
+ computedStyle = window.getComputedStyle(e, null); |
+ shouldBeEqualToString("computedStyle.textDecorationStyle", computedValue); |
+ debug(""); |
} |
-description("Test to make sure text-decoration-style property returns CSSPrimitiveValue properly.") |
+description("Test to make sure text-decoration-style is computed properly.") |
var testContainer = document.createElement("div"); |
testContainer.contentEditable = true; |
@@ -34,42 +17,42 @@ document.body.appendChild(testContainer); |
testContainer.innerHTML = '<div id="test-parent" style="text-decoration-style: dashed !important;">hello <span id="test-ancestor">world</span></div>'; |
debug("Ancestor should not inherit 'dashed' value from parent (fallback to initial 'solid' value):") |
e = document.getElementById('test-ancestor'); |
-testValue(null, "", null, "solid", "[object CSSPrimitiveValue]"); |
+test(null, "", "solid"); |
debug("Parent should cointain 'dashed':"); |
e = document.getElementById('test-parent'); |
-testValue(null, "dashed", "[object CSSPrimitiveValue]", "dashed", "[object CSSPrimitiveValue]"); |
+test(null, "dashed", "dashed"); |
testContainer.innerHTML = '<div id="test-js">test</div>'; |
debug("JavaScript setter tests for valid, initial, invalid and blank values:"); |
e = document.getElementById('test-js'); |
-shouldBeNull("e.style.getPropertyCSSValue('text-decoration-style')"); |
+shouldBeEmptyString("e.style.textDecorationStyle"); |
debug("\nValid value 'solid':"); |
-testValue("solid", "solid", "[object CSSPrimitiveValue]", "solid", "[object CSSPrimitiveValue]"); |
+test("solid", "solid", "solid"); |
debug("Valid value 'double':"); |
-testValue("double", "double", "[object CSSPrimitiveValue]", "double", "[object CSSPrimitiveValue]"); |
+test("double", "double", "double"); |
debug("Valid value 'dotted':"); |
-testValue("dotted", "dotted", "[object CSSPrimitiveValue]", "dotted", "[object CSSPrimitiveValue]"); |
+test("dotted", "dotted", "dotted"); |
debug("Valid value 'dashed':"); |
-testValue("dashed", "dashed", "[object CSSPrimitiveValue]", "dashed", "[object CSSPrimitiveValue]"); |
+test("dashed", "dashed", "dashed"); |
debug("Valid value 'wavy':"); |
-testValue("wavy", "wavy", "[object CSSPrimitiveValue]", "wavy", "[object CSSPrimitiveValue]"); |
+test("wavy", "wavy", "wavy"); |
debug("Initial value:"); |
-testValue("initial", "initial", "[object CSSValue]", "solid", "[object CSSPrimitiveValue]"); |
+test("initial", "initial", "solid"); |
debug("Invalid value (this property accepts one value at a time only):"); |
-testValue("double dotted", "initial", "[object CSSValue]", "solid", "[object CSSPrimitiveValue]"); |
+test("double dotted", "initial", "solid"); |
debug("Invalid value (ie. 'unknown'):"); |
-testValue("unknown", "initial", "[object CSSValue]", "solid", "[object CSSPrimitiveValue]"); |
+test("unknown", "initial", "solid"); |
debug("Empty value (resets the property):"); |
-testValue("", "", null, "solid", "[object CSSPrimitiveValue]"); |
+test("", "", "solid"); |
document.body.removeChild(testContainer); |