1 Tests for .valueAsNumber with <input type=range>.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 PASS valueAsNumberFor("0") is 0
7 PASS valueAsNumberFor("10") is 10
8 PASS valueAsNumberFor("01") is 1
9 PASS valueAsNumberFor("-0") is 0
10 PASS valueAsNumberFor("-1.2") is 0
11 PASS valueAsNumberFor("0.2") is 0
12 PASS valueAsNumberFor(".2") is 0
13 PASS valueAsNumberFor("1.2E10") is 100
14 PASS valueAsNumberFor("1.2E-10") is 0
15 PASS valueAsNumberFor("1.2E+10") is 100
16 PASS valueAsNumberFor("123456789012345678901234567890123456789") is 100
17 PASS valueAsNumberFor("0.12345678901234567890123456789012345678901234567890") is 0
18 valueAsNumber for invalid string values:
19 PASS valueAsNumberFor("") is 50
20 PASS valueAsNumberFor("abc") is 50
21 PASS valueAsNumberFor("0xff") is 50
22 PASS valueAsNumberFor("+1") is 50
23 PASS valueAsNumberFor(" 10") is 50
24 PASS valueAsNumberFor("10 ") is 50
25 PASS valueAsNumberFor("1E") is 50
26 PASS valueAsNumberFor("NaN") is 50
27 PASS valueAsNumberFor("nan") is 50
28 PASS valueAsNumberFor("Inf") is 50
29 PASS valueAsNumberFor("inf") is 50
30 PASS valueAsNumberFor("Infinity") is 50
31 PASS valueAsNumberFor("infinity") is 50
32 Too huge exponent to support
33 PASS valueAsNumberFor("1.2E65535") is 50
34 Tests for the valueAsNumber setter:
35 PASS setValueAsNumberAndGetValue(0) is "0"
36 PASS setValueAsNumberAndGetValue(10) is "10"
37 PASS setValueAsNumberAndGetValue(01) is "1"
38 PASS setValueAsNumberAndGetValue(-0) is "0"
39 PASS setValueAsNumberAndGetValue(-1.2) is "0"
40 PASS setValueAsNumberAndGetValue(1.2e10) is "100"
41 PASS setValueAsNumberAndGetValue(1.2e-10) is "0"
42 PASS setValueAsNumberAndGetValue(1.2345678901234567e+38) is "100"
43 Tests to set invalid values to valueAsNumber:
44 PASS setValueAsNumberAndGetValue(null) is "0"
45 PASS setValueAsNumberAndGetValue(0) is "0"
46 PASS setValueAsNumberAndGetValue("foo") is "50"
47 PASS setValueAsNumberAndGetValue(NaN) is "50"
48 PASS setValueAsNumberAndGetValue(Number.NaN) is "50"
49 PASS setValueAsNumberAndGetValue(Infinity) threw exception TypeError: Failed to set the 'valueAsNumber' property on 'HTMLInputElement': The value provided is infinite..
50 PASS setValueAsNumberAndGetValue(Number.POSITIVE_INFINITY) threw exception TypeError: Failed to set the 'valueAsNumber' property on 'HTMLInputElement': The value provided is infinite..
51 PASS setValueAsNumberAndGetValue(Number.NEGATIVE_INFINITY) threw exception TypeError: Failed to set the 'valueAsNumber' property on 'HTMLInputElement': The value provided is infinite..
52 PASS successfullyParsed is true