| OLD | NEW |
| 1 function testElementStyle(propertyJS, propertyCSS, type, value) | 1 function testElementStyle(propertyJS, propertyCSS, type, value) |
| 2 { | 2 { |
| 3 if (type != null) { | 3 if (type != null) { |
| 4 shouldBe("e.style." + propertyJS, "'" + value + "'"); | 4 shouldBe("e.style." + propertyJS, "'" + value + "'"); |
| 5 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()"
, "'" + type + "'"); | 5 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()"
, "'" + type + "'"); |
| 6 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", "
'" + value + "'"); | 6 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", "
'" + value + "'"); |
| 7 } else | 7 } else |
| 8 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')"); | 8 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')"); |
| 9 } | 9 } |
| 10 | 10 |
| 11 function testComputedStyle(propertyJS, propertyCSS, type, value) | 11 function testComputedStyle(propertyJS, propertyCSS, type, value) |
| 12 { | 12 { |
| 13 computedStyle = window.getComputedStyle(e, null); | 13 computedStyle = window.getComputedStyle(e, null); |
| 14 shouldBe("computedStyle." + propertyJS, "'" + value + "'"); | 14 shouldBe("computedStyle." + propertyJS, "'" + value + "'"); |
| 15 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString(
)", "'" + type + "'"); | 15 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString(
)", "'" + type + "'"); |
| 16 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText",
"'" + value + "'"); | 16 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText",
"'" + value + "'"); |
| 17 } | 17 } |
| 18 | 18 |
| 19 description("Test to make sure text-underline-position property returns values p
roperly.") | 19 description("Test to make sure text-underline-position property returns values p
roperly.") |
| 20 | 20 |
| 21 // FIXME: This test tests property values 'auto', 'alphabetic' and 'under'. We d
on't fully match | 21 // FIXME: This test tests property values 'auto' and 'under'. We don't fully mat
ch |
| 22 // the specification as we don't support [ left | right ] and this is left for a
nother implementation | 22 // the specification as we don't support [ left | right ] and this is left for a
nother implementation |
| 23 // as the rendering will need to be added. | 23 // as the rendering will need to be added. |
| 24 | 24 |
| 25 var testContainer = document.createElement("div"); | 25 var testContainer = document.createElement("div"); |
| 26 testContainer.contentEditable = true; | 26 testContainer.contentEditable = true; |
| 27 document.body.appendChild(testContainer); | 27 document.body.appendChild(testContainer); |
| 28 | 28 |
| 29 testContainer.innerHTML = '<div id="test">hello world</div>'; | 29 testContainer.innerHTML = '<div id="test">hello world</div>'; |
| 30 | 30 |
| 31 debug("Initial value:"); | 31 debug("Initial value:"); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 45 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS
SValue]", "initial"); | 45 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS
SValue]", "initial"); |
| 46 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "auto"); | 46 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "auto"); |
| 47 debug(''); | 47 debug(''); |
| 48 | 48 |
| 49 debug("Value 'auto':"); | 49 debug("Value 'auto':"); |
| 50 e.style.textUnderlinePosition = 'auto'; | 50 e.style.textUnderlinePosition = 'auto'; |
| 51 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS
SPrimitiveValue]", "auto"); | 51 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS
SPrimitiveValue]", "auto"); |
| 52 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "auto"); | 52 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "auto"); |
| 53 debug(''); | 53 debug(''); |
| 54 | 54 |
| 55 debug("Value 'alphabetic':"); | |
| 56 e.style.textUnderlinePosition = 'alphabetic'; | |
| 57 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS
SPrimitiveValue]", "alphabetic"); | |
| 58 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "alphabetic"); | |
| 59 debug(''); | |
| 60 | |
| 61 debug("Value 'under':"); | 55 debug("Value 'under':"); |
| 62 e.style.textUnderlinePosition = 'under'; | 56 e.style.textUnderlinePosition = 'under'; |
| 63 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS
SPrimitiveValue]", "under"); | 57 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS
SPrimitiveValue]", "under"); |
| 64 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "under"); | 58 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "under"); |
| 65 debug(''); | 59 debug(''); |
| 66 | 60 |
| 67 testContainer.innerHTML = '<div id="test-parent" style="text-underline-position:
under;">hello <span id="test-ancestor">world</span></div>'; | 61 testContainer.innerHTML = '<div id="test-parent" style="text-underline-position:
under;">hello <span id="test-ancestor">world</span></div>'; |
| 68 debug("Ancestor inherits values from parent:"); | 62 debug("Ancestor inherits values from parent:"); |
| 69 e = document.getElementById('test-ancestor'); | 63 e = document.getElementById('test-ancestor'); |
| 70 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); | 64 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); |
| 71 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "under"); | 65 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C
SSPrimitiveValue]", "under"); |
| 72 debug(''); | 66 debug(''); |
| 73 | 67 |
| 74 debug("Value 'auto alphabetic':"); | |
| 75 e.style.textUnderlinePosition = 'auto alphabetic'; | |
| 76 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); | |
| 77 debug(''); | |
| 78 | |
| 79 debug("Value 'auto under':"); | 68 debug("Value 'auto under':"); |
| 80 e.style.textUnderlinePosition = 'auto under'; | 69 e.style.textUnderlinePosition = 'auto under'; |
| 81 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); | 70 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); |
| 82 debug(''); | 71 debug(''); |
| 83 | 72 |
| 84 debug("Value 'under under':"); | 73 debug("Value 'under under':"); |
| 85 e.style.textUnderlinePosition = 'under under'; | 74 e.style.textUnderlinePosition = 'under under'; |
| 86 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); | 75 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); |
| 87 debug(''); | 76 debug(''); |
| 88 | 77 |
| 89 debug("Value 'under under under':"); | 78 debug("Value 'under under under':"); |
| 90 e.style.textUnderlinePosition = 'auto alphabetic under'; | 79 e.style.textUnderlinePosition = 'auto alphabetic under'; |
| 91 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); | 80 testElementStyle("textUnderlinePosition", "text-underline-position", null, ""); |
| 92 debug(''); | 81 debug(''); |
| 93 | 82 |
| 94 document.body.removeChild(testContainer); | 83 document.body.removeChild(testContainer); |
| OLD | NEW |