Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / length-attribute-mapping.html
blob7e491a6c2030460e3af7dd242c8658882a582271
1 <p>
2 This tests the mapping of length-type attributes to CSS length values.
3 </p>
4 <pre id="console"></pre>
5 <img id="img" style="display: none;">
6 <table><col id="col" style="display: none;"></table>
7 <script>
8 if (window.testRunner)
9 testRunner.dumpAsText();
11 var console = document.getElementById("console");
12 function log(message)
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);
24 else
25 log("FAIL: " + value + " is " + mapping + " instead of " + (expected ? expected : "not being mapped"));
28 var img = document.getElementById("img");
29 log ("<img>:");
30 test(img, "90zz", "90px");
31 test(img, "80%", "80%");
32 test(img, "70%5", "70%");
33 test(img, "60%%", "60%");
34 test(img, "50*");
35 test(img, "40*5");
36 test(img, "30.5", "30.5px");
37 log("");
39 var col = document.getElementById("col");
40 log ("<col>:");
41 test(col, "90zz", "90px");
42 test(col, "80%", "80%");
43 test(col, "70%5", "70%");
44 test(col, "60%%", "60%");
45 test(col, "50*");
46 test(col, "40*5");
47 test(col, "30.5", "30.5px");
48 </script>