blob: 3120299dbebedb9cbf5cc7e350072f1a0ccb4958 [file] [log] [blame]
Tests for .valueAsNumber with <input type=time>.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS valueAsNumberFor("") is Number.NaN
PASS valueAsNumberFor("00:00:00.000") is Date.UTC(1970, 0, 1, 0, 0, 0, 0)
PASS valueAsNumberFor("04:35") is Date.UTC(1970, 0, 1, 4, 35, 0, 0)
PASS valueAsNumberFor("23:59:59.999") is Date.UTC(1970, 0, 1, 23, 59, 59, 999)
PASS setValueAsNumberAndGetValue(0, 0, 0, 0) is "00:00"
PASS setValueAsNumberAndGetValue(0, 0, 1, 0) is "00:00:01"
PASS setValueAsNumberAndGetValue(0, 0, 0, 2) is "00:00:00.002"
PASS setValueAsNumberAndGetValue(11, 59, 59, 999) is "11:59:59.999"
PASS setValueAsNumberAndGetValue(12, 0, 0, 0) is "12:00"
PASS setValueAsNumberAndGetValue(23, 59, 59, 999) is "23:59:59.999"
PASS setValueAsNumberAndGetValue(24, 0, 0, 0) is "00:00"
PASS setValueAsNumberAndGetValue(48, 0, 13, 0) is "00:00:13"
PASS setValueAsNumberAndGetValue(-23, -59, -59, 0) is "00:00:01"
Tests to set invalid values to valueAsNumber:
PASS input.value = ""; input.valueAsNumber = null; input.value is "00:00"
PASS input.valueAsNumber = "foo" threw exception Error: NotSupportedError: DOM Exception 9.
PASS input.valueAsNumber = NaN threw exception Error: NotSupportedError: DOM Exception 9.
PASS input.valueAsNumber = Number.NaN threw exception Error: NotSupportedError: DOM Exception 9.
PASS input.valueAsNumber = Infinity threw exception Error: NotSupportedError: DOM Exception 9.
PASS input.valueAsNumber = Number.POSITIVE_INFINITY threw exception Error: NotSupportedError: DOM Exception 9.
PASS input.valueAsNumber = Number.NEGATIVE_INFINITY threw exception Error: NotSupportedError: DOM Exception 9.
Step attribute value and string representation:
PASS input.step = "1"; setValueAsNumberAndGetValue(0, 0, 0, 0) is "00:00:00"
PASS input.step = "0.001"; setValueAsNumberAndGetValue(0, 0, 0, 0) is "00:00:00.000"
PASS successfullyParsed is true
TEST COMPLETE