| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| description("Tests that border shorthands are computed properly.") |
| |
| var testContainer = document.createElement("div"); |
| testContainer.contentEditable = true; |
| document.body.appendChild(testContainer); |
| |
| testContainer.innerHTML = '<div id="test">hello</div>'; |
| |
| e = document.getElementById('test'); |
| computedStyle = window.getComputedStyle(e, null); |
| |
| var properties = new Array("border-bottom","border-top","border-right", "border-left"); |
| |
| for (i = 0; i < properties.length; ++i) { |
| e.style.cssText = properties[i] + ": 10px solid red;"; |
| shouldBe("computedStyle.getPropertyValue('" + properties[i] + "')", "'10px solid rgb(255, 0, 0)'"); |
| |
| e.style.cssText = properties[i] + ": 20em solid blue;"; |
| shouldBe("computedStyle.getPropertyValue('" + properties[i] + "')", "'320px solid rgb(0, 0, 255)'"); |
| |
| e.style.cssText = properties[i] + ": 10px none green;"; |
| shouldBe("computedStyle.getPropertyValue('" + properties[i] + "')", "'0px none rgb(0, 128, 0)'"); |
| } |
| |
| e.style.cssText = ""; |
| e.style.border = "20em solid red"; |
| shouldBe("computedStyle.getPropertyValue('border')", "'320px solid rgb(255, 0, 0)'"); |
| |
| e.style.border = "20em solid red"; |
| e.style.borderTop = "10px groove blue"; |
| shouldBe("computedStyle.getPropertyValue('border')", "''"); |
| |
| |
| document.body.removeChild(testContainer); |
| |
| </script> |
| </body> |
| </html> |