Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / range / range-value-rounding.html
blob589574bac4ea9e780f0e13cd7b3be3ef6bd9623e
1 <head>
2 <script src="../../../resources/js-test.js"></script>
3 </head>
4 <body>
5 <input id="foo" type=range step=0.1 value=0.6>
6 <div id="console"></div>
7 <div id="sliders"></div>
8 <script>
9 description("<a href='http://bugs.webkit.org/show_bug.cgi?id=80009'>80009 Introduce Decimal arithmetic to fix rounding errors in number/range input types</a>");
11 function createSample(step, value, max)
13 var container = document.createElement("span");
14 container.innerHTML = '<input type=range min=0 max=' + max + ' step=' + step + ' value=' + value + '><br>';
15 document.getElementById("sliders").appendChild(container);
16 return container.firstChild;
19 var zeros = "0.";
20 for (var exponent = 0; exponent < 15; ++exponent) {
21 var step = zeros + "1";
22 for (var digit = 1; digit <= 9; ++digit) {
23 var value = zeros + digit.toString();
24 var sample = 'createSample("' + step + '", "' + value + '", "1e-' + exponent + '")';
25 var stepExponent = exponent + 1;
26 shouldBeEqualToString(sample + '.value', stepExponent >= 7 ? digit + "e-" + stepExponent : value);
27 shouldBe(sample + '.valueAsNumber', value);
29 zeros += "0";
32 // Remove generated sliders.
33 document.getElementById("sliders").innerHTML = "";
34 </script>
35 </body>