| Index: LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-color.js
|
| diff --git a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-color.js b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-color.js
|
| index 8bc6825759e1c5c3a5d7f4e57e0fc7b00013c208..486601093398eb7d3d7340e2cb2526c51501891c 100644
|
| --- a/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-color.js
|
| +++ b/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-decoration-color.js
|
| @@ -1,31 +1,14 @@
|
| -function testElementStyle(type, value)
|
| +function test(value, inlineValue, computedValue)
|
| {
|
| - if (type != null) {
|
| - shouldBe("e.style.textDecorationColor", "'" + value + "'");
|
| - shouldBe("e.style.getPropertyCSSValue('text-decoration-color').toString()", "'" + type + "'");
|
| - shouldBe("e.style.getPropertyCSSValue('text-decoration-color').cssText", "'" + value + "'");
|
| - } else
|
| - shouldBeNull("e.style.getPropertyCSSValue('text-decoration-color')");
|
| -}
|
| -
|
| -function testComputedStyleValue(type, value)
|
| -{
|
| - computedStyle = window.getComputedStyle(e, null);
|
| - shouldBe("computedStyle.getPropertyCSSValue('text-decoration-color').toString()", "'" + type + "'");
|
| - shouldBe("computedStyle.getPropertyCSSValue('text-decoration-color').cssText", "'" + value + "'");
|
| - shouldBe("computedStyle.textDecorationColor", "'" + value + "'");
|
| -}
|
| -
|
| -function testValue(value, elementValue, elementStyle, computedValue, computedStyle)
|
| -{
|
| - if (value != null)
|
| + if (value !== null)
|
| e.style.textDecorationColor = value;
|
| - testElementStyle(elementStyle, elementValue);
|
| - testComputedStyleValue(computedStyle, computedValue);
|
| + shouldBeEqualToString("e.style.textDecorationColor", inlineValue);
|
| + computedStyle = window.getComputedStyle(e, null);
|
| + shouldBeEqualToString("computedStyle.textDecorationColor", computedValue);
|
| debug('');
|
| }
|
|
|
| -description("Test to make sure text-decoration-color property returns CSSPrimitiveValue properly.")
|
| +description("Test to make sure text-decoration-color is computed properly.")
|
|
|
| var testContainer = document.createElement("div");
|
| testContainer.contentEditable = true;
|
| @@ -34,46 +17,46 @@ document.body.appendChild(testContainer);
|
| testContainer.innerHTML = '<div id="test-parent" style="text-decoration-color: green !important;">hello <span id="test-ancestor">world</span></div>';
|
| debug("Ancestor should not inherit 'green' value from parent (fallback to initial value):")
|
| e = document.getElementById('test-ancestor');
|
| -testValue(null, "", null, "rgb(0, 0, 0)", "[object CSSPrimitiveValue]");
|
| +test(null, "", "rgb(0, 0, 0)");
|
|
|
| debug("Parent should contain 'green':");
|
| e = document.getElementById('test-parent');
|
| -testValue(null, "green", "[object CSSPrimitiveValue]", "rgb(0, 128, 0)", "[object CSSPrimitiveValue]");
|
| +test(null, "green", "rgb(0, 128, 0)");
|
|
|
| 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-color')");
|
| +shouldBeEmptyString("e.style.textDecorationColor");
|
|
|
| debug("\nValid value 'blue':");
|
| -testValue("blue", "blue", "[object CSSPrimitiveValue]", "rgb(0, 0, 255)", "[object CSSPrimitiveValue]");
|
| +test("blue", "blue", "rgb(0, 0, 255)");
|
|
|
| debug("Valid value '#FFFFFF':");
|
| -testValue("#FFFFFF", "rgb(255, 255, 255)", "[object CSSPrimitiveValue]", "rgb(255, 255, 255)", "[object CSSPrimitiveValue]");
|
| +test("#FFFFFF", "rgb(255, 255, 255)", "rgb(255, 255, 255)");
|
|
|
| debug("Valid value 'rgb(0, 255, 0)':");
|
| -testValue("rgb(0, 255, 0)", "rgb(0, 255, 0)", "[object CSSPrimitiveValue]", "rgb(0, 255, 0)", "[object CSSPrimitiveValue]");
|
| +test("rgb(0, 255, 0)", "rgb(0, 255, 0)", "rgb(0, 255, 0)");
|
|
|
| debug("Valid value 'rgba(100, 100, 100, 0.5)':");
|
| -testValue("rgba(100, 100, 100, 0.5)", "rgba(100, 100, 100, 0.498039)", "[object CSSPrimitiveValue]", "rgba(100, 100, 100, 0.498039)", "[object CSSPrimitiveValue]");
|
| +test("rgba(100, 100, 100, 0.5)", "rgba(100, 100, 100, 0.498039)", "rgba(100, 100, 100, 0.498039)");
|
|
|
| debug("Valid value 'hsl(240, 100%, 50%)':");
|
| -testValue("hsl(240, 100%, 50%)", "rgb(0, 0, 255)", "[object CSSPrimitiveValue]", "rgb(0, 0, 255)", "[object CSSPrimitiveValue]");
|
| +test("hsl(240, 100%, 50%)", "rgb(0, 0, 255)", "rgb(0, 0, 255)");
|
|
|
| debug("Valid value 'hsla(240, 100%, 50%, 0.5)':");
|
| -testValue("hsla(240, 100%, 50%, 0.5)", "rgba(0, 0, 255, 0.498039)", "[object CSSPrimitiveValue]", "rgba(0, 0, 255, 0.498039)", "[object CSSPrimitiveValue]");
|
| +test("hsla(240, 100%, 50%, 0.5)", "rgba(0, 0, 255, 0.498039)", "rgba(0, 0, 255, 0.498039)");
|
|
|
| debug("Initial value:");
|
| -testValue("initial", "initial", "[object CSSValue]", "rgb(0, 0, 0)", "[object CSSPrimitiveValue]");
|
| +test("initial", "initial", "rgb(0, 0, 0)");
|
|
|
| debug("Invalid value (ie. 'unknown'):");
|
| -testValue("unknown", "initial", "[object CSSValue]", "rgb(0, 0, 0)", "[object CSSPrimitiveValue]");
|
| +test("unknown", "initial", "rgb(0, 0, 0)");
|
|
|
| debug("Empty value (resets the property):");
|
| -testValue("", "", null, "rgb(0, 0, 0)", "[object CSSPrimitiveValue]");
|
| +test("", "", "rgb(0, 0, 0)");
|
|
|
| debug("Empty value with different 'currentColor' initial value (green):")
|
| e.style.color = 'green';
|
| -testValue("", "", null, "rgb(0, 128, 0)", "[object CSSPrimitiveValue]");
|
| +test("", "", "rgb(0, 128, 0)");
|
|
|
| document.body.removeChild(testContainer);
|
|
|