35 lines
1.7 KiB
Plaintext
35 lines
1.7 KiB
Plaintext
Tests for .valueAsNumber with <input type=month>.
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
PASS valueAsNumberFor("") is Number.NaN
|
|
PASS valueAsNumberFor("1969-01") is -12
|
|
PASS valueAsNumberFor("1969-12") is -1
|
|
PASS valueAsNumberFor("1970-01") is 0
|
|
PASS valueAsNumberFor("1970-12") is 11
|
|
PASS valueAsNumberFor("1971-01") is 12
|
|
PASS valueAsNumberFor("2009-12") is (2009-1970)*12+11
|
|
PASS input.valueAsNumber = -1; input.value is "1969-12"
|
|
PASS input.valueAsNumber = 0; input.value is "1970-01"
|
|
PASS setValueAsNumberAndGetValue(2009, 12) is "2009-12"
|
|
PASS setValueAsNumberAndGetValue(10000, 1) is "10000-01"
|
|
PASS setValueAsNumberAndGetValue(-1, 1) is ""
|
|
PASS setValueAsNumberAndGetValue(0, 12) is ""
|
|
PASS setValueAsNumberAndGetValue(1, 1) is "0001-01"
|
|
PASS setValueAsNumberAndGetValue(1, 2) is "0001-02"
|
|
PASS setValueAsNumberAndGetValue(275760, 9) is "275760-09"
|
|
PASS setValueAsNumberAndGetValue(275760, 10) is ""
|
|
Tests to set invalid values to valueAsNumber:
|
|
PASS input.value = ""; input.valueAsNumber = null; input.value is "1970-01"
|
|
PASS input.valueAsNumber = "foo" threw exception NotSupportedError: The operation is not supported..
|
|
PASS input.valueAsNumber = NaN threw exception NotSupportedError: The operation is not supported..
|
|
PASS input.valueAsNumber = Number.NaN threw exception NotSupportedError: The operation is not supported..
|
|
PASS input.valueAsNumber = Infinity threw exception NotSupportedError: The operation is not supported..
|
|
PASS input.valueAsNumber = Number.POSITIVE_INFINITY threw exception NotSupportedError: The operation is not supported..
|
|
PASS input.valueAsNumber = Number.NEGATIVE_INFINITY threw exception NotSupportedError: The operation is not supported..
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|