blob: 7e491a6c2030460e3af7dd242c8658882a582271 [file] [log] [blame]
<p>
This tests the mapping of length-type attributes to CSS length values.
</p>
<pre id="console"></pre>
<img id="img" style="display: none;">
<table><col id="col" style="display: none;"></table>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var console = document.getElementById("console");
function log(message)
{
console.appendChild(document.createTextNode(message + "\n"));
}
function test(target, value, expected)
{
target.setAttribute("height", value);
var actual = getComputedStyle(target, null).height;
var mapping = actual == "auto" ? "not mapped" : "mapped to " + actual;
if (actual == (expected ? expected : "auto"))
log("PASS: " + value + " is " + mapping);
else
log("FAIL: " + value + " is " + mapping + " instead of " + (expected ? expected : "not being mapped"));
}
var img = document.getElementById("img");
log ("<img>:");
test(img, "90zz", "90px");
test(img, "80%", "80%");
test(img, "70%5", "70%");
test(img, "60%%", "60%");
test(img, "50*");
test(img, "40*5");
test(img, "30.5", "30.5px");
log("");
var col = document.getElementById("col");
log ("<col>:");
test(col, "90zz", "90px");
test(col, "80%", "80%");
test(col, "70%5", "70%");
test(col, "60%%", "60%");
test(col, "50*");
test(col, "40*5");
test(col, "30.5", "30.5px");
</script>