| <!doctype html> |
| <title>Whitespace in attribute values tests</title> |
| <script src=../../resources/testharness.js></script> |
| <script src=../../resources/testharnessreport.js></script> |
| <script src=resources/whitespace-helper.js></script> |
| <svg id="testcontainer"> |
| </svg> |
| <div id=log></div> |
| <script> |
| var svg = document.querySelector("svg"); |
| |
| // test length values |
| var EPSILON = Math.pow(2, -24); // float epsilon |
| var whitespace = [ "", " ", " ", "\r\n\t ", "\f" ]; |
| var validunits = [ "", "em", "ex", "px", "in", "cm", "mm", "pt", "pc", "%" ]; |
| |
| // This test was split out from whitespace-length.html because the trybots were too slow. |
| |
| testInvalidType("<length>", |
| svg, |
| "x", |
| 0, // expected default value |
| whitespace, |
| [ "E", "e", "e+", "E-" ], // invalid |
| validunits, |
| function(elm, value) { assert_approx_equals(elm.x.baseVal.valueInSpecifiedUnits, parseFloat(value), EPSILON); }, |
| function(elm, expected) { assert_approx_equals(elm.x.baseVal.value, expected, EPSILON); } ); |
| |
| </script> |