blob: 5be3c0348936ad35c4f2087bc1c6f9fee22be2b5 [file] [log] [blame]
Tests for .valueAsNumber with <input type=date>.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS valueAsNumberFor("") is Number.NaN
PASS valueAsNumberFor("1969-12-31") is Date.UTC(1969, 11, 31)
PASS valueAsNumberFor("1970-01-01") is Date.UTC(1970, 0, 1)
PASS valueAsNumberFor("2009-12-22") is Date.UTC(2009, 11, 22)
PASS setValueAsNumberAndGetValue(1969, 11, 1) is "1969-12-01"
PASS setValueAsNumberAndGetValue(1970, 0, 1) is "1970-01-01"
PASS setValueAsNumberAndGetValue(2009, 11, 31) is "2009-12-31"
PASS setValueAsNumberAndGetValue(10000, 0, 1) is "10000-01-01"
PASS setValueAsNumberAndGetValue(-1, 0, 1) is ""
PASS setValueAsNumberAndGetValue(0, 11, 31) is ""
PASS setValueAsNumberAndGetValue(1, 0, 1) is "0001-01-01"
PASS setValueAsNumberAndGetValue(275760, 8, 13) is "275760-09-13"
Tests to set invalid values to valueAsNumber:
PASS input.value = ""; input.valueAsNumber = null; input.value is "1970-01-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 input.valueAsNumber = Date.UTC(275760, 8, 14) threw exception NotSupportedError: The operation is not supported..
PASS successfullyParsed is true
TEST COMPLETE