blob: f201243b1ff3289d7a9f7fb6c03200d3476e946a [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 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..
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.0"
PASS successfullyParsed is true
TEST COMPLETE