| OLD | NEW |
| 1 function testElementStyle(type, value) | 1 function testElementStyle(type, value) |
| 2 { | 2 { |
| 3 if (type != null) { | 3 if (type != null) { |
| 4 shouldBe("e.style.webkitTextDecorationStyle", "'" + value + "'"); | 4 shouldBe("e.style.textDecorationStyle", "'" + value + "'"); |
| 5 shouldBe("e.style.getPropertyCSSValue('-webkit-text-decoration-style').t
oString()", "'" + type + "'"); | 5 shouldBe("e.style.getPropertyCSSValue('text-decoration-style').toString(
)", "'" + type + "'"); |
| 6 shouldBe("e.style.getPropertyCSSValue('-webkit-text-decoration-style').c
ssText", "'" + value + "'"); | 6 shouldBe("e.style.getPropertyCSSValue('text-decoration-style').cssText",
"'" + value + "'"); |
| 7 } else | 7 } else |
| 8 shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-style
')"); | 8 shouldBeNull("e.style.getPropertyCSSValue('text-decoration-style')"); |
| 9 } | 9 } |
| 10 | 10 |
| 11 function testComputedStyleValue(type, value) | 11 function testComputedStyleValue(type, value) |
| 12 { | 12 { |
| 13 computedStyle = window.getComputedStyle(e, null); | 13 computedStyle = window.getComputedStyle(e, null); |
| 14 shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-style')
.toString()", "'" + type + "'"); | 14 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-style').toStrin
g()", "'" + type + "'"); |
| 15 shouldBe("computedStyle.getPropertyCSSValue('-webkit-text-decoration-style')
.cssText", "'" + value + "'"); | 15 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-style').cssText
", "'" + value + "'"); |
| 16 shouldBe("computedStyle.webkitTextDecorationStyle", "'" + value + "'"); | 16 shouldBe("computedStyle.textDecorationStyle", "'" + value + "'"); |
| 17 } | 17 } |
| 18 | 18 |
| 19 function testValue(value, elementValue, elementStyle, computedValue, computedSty
le) | 19 function testValue(value, elementValue, elementStyle, computedValue, computedSty
le) |
| 20 { | 20 { |
| 21 if (value != null) | 21 if (value != null) |
| 22 e.style.webkitTextDecorationStyle = value; | 22 e.style.textDecorationStyle = value; |
| 23 testElementStyle(elementStyle, elementValue); | 23 testElementStyle(elementStyle, elementValue); |
| 24 testComputedStyleValue(computedStyle, computedValue); | 24 testComputedStyleValue(computedStyle, computedValue); |
| 25 debug(''); | 25 debug(''); |
| 26 } | 26 } |
| 27 | 27 |
| 28 description("Test to make sure -webkit-text-decoration-style property returns CS
SPrimitiveValue properly.") | 28 description("Test to make sure text-decoration-style property returns CSSPrimiti
veValue properly.") |
| 29 | 29 |
| 30 var testContainer = document.createElement("div"); | 30 var testContainer = document.createElement("div"); |
| 31 testContainer.contentEditable = true; | 31 testContainer.contentEditable = true; |
| 32 document.body.appendChild(testContainer); | 32 document.body.appendChild(testContainer); |
| 33 | 33 |
| 34 testContainer.innerHTML = '<div id="test-parent" style="-webkit-text-decoration-
style: dashed !important;">hello <span id="test-ancestor">world</span></div>'; | 34 testContainer.innerHTML = '<div id="test-parent" style="text-decoration-style: d
ashed !important;">hello <span id="test-ancestor">world</span></div>'; |
| 35 debug("Ancestor should not inherit 'dashed' value from parent (fallback to initi
al 'solid' value):") | 35 debug("Ancestor should not inherit 'dashed' value from parent (fallback to initi
al 'solid' value):") |
| 36 e = document.getElementById('test-ancestor'); | 36 e = document.getElementById('test-ancestor'); |
| 37 testValue(null, "", null, "solid", "[object CSSPrimitiveValue]"); | 37 testValue(null, "", null, "solid", "[object CSSPrimitiveValue]"); |
| 38 | 38 |
| 39 debug("Parent should cointain 'dashed':"); | 39 debug("Parent should cointain 'dashed':"); |
| 40 e = document.getElementById('test-parent'); | 40 e = document.getElementById('test-parent'); |
| 41 testValue(null, "dashed", "[object CSSPrimitiveValue]", "dashed", "[object CSSPr
imitiveValue]"); | 41 testValue(null, "dashed", "[object CSSPrimitiveValue]", "dashed", "[object CSSPr
imitiveValue]"); |
| 42 | 42 |
| 43 testContainer.innerHTML = '<div id="test-js">test</div>'; | 43 testContainer.innerHTML = '<div id="test-js">test</div>'; |
| 44 debug("JavaScript setter tests for valid, initial, invalid and blank values:"); | 44 debug("JavaScript setter tests for valid, initial, invalid and blank values:"); |
| 45 e = document.getElementById('test-js'); | 45 e = document.getElementById('test-js'); |
| 46 shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration-style')"); | 46 shouldBeNull("e.style.getPropertyCSSValue('text-decoration-style')"); |
| 47 | 47 |
| 48 debug("\nValid value 'solid':"); | 48 debug("\nValid value 'solid':"); |
| 49 testValue("solid", "solid", "[object CSSPrimitiveValue]", "solid", "[object CSSP
rimitiveValue]"); | 49 testValue("solid", "solid", "[object CSSPrimitiveValue]", "solid", "[object CSSP
rimitiveValue]"); |
| 50 | 50 |
| 51 debug("Valid value 'double':"); | 51 debug("Valid value 'double':"); |
| 52 testValue("double", "double", "[object CSSPrimitiveValue]", "double", "[object C
SSPrimitiveValue]"); | 52 testValue("double", "double", "[object CSSPrimitiveValue]", "double", "[object C
SSPrimitiveValue]"); |
| 53 | 53 |
| 54 debug("Valid value 'dotted':"); | 54 debug("Valid value 'dotted':"); |
| 55 testValue("dotted", "dotted", "[object CSSPrimitiveValue]", "dotted", "[object C
SSPrimitiveValue]"); | 55 testValue("dotted", "dotted", "[object CSSPrimitiveValue]", "dotted", "[object C
SSPrimitiveValue]"); |
| 56 | 56 |
| 57 debug("Valid value 'dashed':"); | 57 debug("Valid value 'dashed':"); |
| 58 testValue("dashed", "dashed", "[object CSSPrimitiveValue]", "dashed", "[object C
SSPrimitiveValue]"); | 58 testValue("dashed", "dashed", "[object CSSPrimitiveValue]", "dashed", "[object C
SSPrimitiveValue]"); |
| 59 | 59 |
| 60 debug("Valid value 'wavy':"); | 60 debug("Valid value 'wavy':"); |
| 61 testValue("wavy", "wavy", "[object CSSPrimitiveValue]", "wavy", "[object CSSPrim
itiveValue]"); | 61 testValue("wavy", "wavy", "[object CSSPrimitiveValue]", "wavy", "[object CSSPrim
itiveValue]"); |
| 62 | 62 |
| 63 debug("Initial value:"); | 63 debug("Initial value:"); |
| 64 testValue("initial", "initial", "[object CSSValue]", "solid", "[object CSSPrimit
iveValue]"); | 64 testValue("initial", "initial", "[object CSSValue]", "solid", "[object CSSPrimit
iveValue]"); |
| 65 | 65 |
| 66 debug("Invalid value (this property accepts one value at a time only):"); | 66 debug("Invalid value (this property accepts one value at a time only):"); |
| 67 testValue("double dotted", "initial", "[object CSSValue]", "solid", "[object CSS
PrimitiveValue]"); | 67 testValue("double dotted", "initial", "[object CSSValue]", "solid", "[object CSS
PrimitiveValue]"); |
| 68 | 68 |
| 69 debug("Invalid value (ie. 'unknown'):"); | 69 debug("Invalid value (ie. 'unknown'):"); |
| 70 testValue("unknown", "initial", "[object CSSValue]", "solid", "[object CSSPrimit
iveValue]"); | 70 testValue("unknown", "initial", "[object CSSValue]", "solid", "[object CSSPrimit
iveValue]"); |
| 71 | 71 |
| 72 debug("Empty value (resets the property):"); | 72 debug("Empty value (resets the property):"); |
| 73 testValue("", "", null, "solid", "[object CSSPrimitiveValue]"); | 73 testValue("", "", null, "solid", "[object CSSPrimitiveValue]"); |
| 74 | 74 |
| 75 document.body.removeChild(testContainer); | 75 document.body.removeChild(testContainer); |
| OLD | NEW |