Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / script-tests / invalid-length-units.js
bloba89a248e352b733c0c613e86c681cfbb3690e468
1 description("Tests handling of invalid SVG length units.");
3 var svgNS = "http://www.w3.org/2000/svg";
5 var svgRoot = document.createElementNS(svgNS, "svg");
6 document.documentElement.appendChild(svgRoot);
8 rect = document.createElementNS(svgNS, "rect");
9 svgRoot.appendChild(rect);
11 function trySettingLength(length, expected)
13     rect.setAttribute('x', "1234");
14     shouldBe("rect.setAttribute('x', '" + length + "'); rect.x.baseVal.valueAsString", expected);
17 trySettingLength("", "'0'");
18 trySettingLength(" ", "'0'");
19 trySettingLength("foo", "'0'");
20 trySettingLength("10foo", "'0'");
21 trySettingLength("px", "'0'");
22 trySettingLength("10px ", "'10px'");
23 trySettingLength("10% ", "'10%'");
24 trySettingLength("10 % ", "'0'");
25 trySettingLength("10 %", "'0'");
26 trySettingLength("10 px ", "'0'");
27 trySettingLength("10 px", "'0'");
28 trySettingLength("10", "'10'");
29 trySettingLength("10%", "'10%'");
30 trySettingLength("10em", "'10em'");
31 trySettingLength("10ex", "'10ex'");
32 trySettingLength("10px", "'10px'");
33 trySettingLength("10cm", "'10cm'");
34 trySettingLength("10mm", "'10mm'");
35 trySettingLength("10pt", "'10pt'");
36 trySettingLength("10pc", "'10pc'");
38 document.documentElement.removeChild(svgRoot);
40 var successfullyParsed = true;