2 <script src=
"../../../resources/js-test.js"></script>
5 <input id=
"foo" type=range step=
0.1 value=
0.6>
6 <div id=
"console"></div>
7 <div id=
"sliders"></div>
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
;
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
);
32 // Remove generated sliders.
33 document
.getElementById("sliders").innerHTML
= "";