2 This tests the mapping of length-type attributes to CSS length values.
4 <pre id=
"console"></pre>
5 <img id=
"img" style=
"display: none;">
6 <table><col id=
"col" style=
"display: none;"></table>
9 testRunner
.dumpAsText();
11 var console
= document
.getElementById("console");
14 console
.appendChild(document
.createTextNode(message
+ "\n"));
17 function test(target
, value
, expected
)
19 target
.setAttribute("height", value
);
20 var actual
= getComputedStyle(target
, null).height
;
21 var mapping
= actual
== "auto" ? "not mapped" : "mapped to " + actual
;
22 if (actual
== (expected
? expected
: "auto"))
23 log("PASS: " + value
+ " is " + mapping
);
25 log("FAIL: " + value
+ " is " + mapping
+ " instead of " + (expected
? expected
: "not being mapped"));
28 var img
= document
.getElementById("img");
30 test(img
, "90zz", "90px");
31 test(img
, "80%", "80%");
32 test(img
, "70%5", "70%");
33 test(img
, "60%%", "60%");
36 test(img
, "30.5", "30.5px");
39 var col
= document
.getElementById("col");
41 test(col
, "90zz", "90px");
42 test(col
, "80%", "80%");
43 test(col
, "70%5", "70%");
44 test(col
, "60%%", "60%");
47 test(col
, "30.5", "30.5px");