blob: f4bc77fa840371f8ae958700d3e088938dbf7075 [file] [log] [blame]
Tests for .valueAsNumber with <input type=datetime>.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS valueAsNumberFor("") is Number.NaN
PASS valueAsNumberFor("1969-12-31T12:34:56.789Z") is Date.UTC(1969, 11, 31, 12, 34, 56, 789)
PASS valueAsNumberFor("1970-01-01T00:00:00.000Z") is Date.UTC(1970, 0, 1, 0, 0, 0)
PASS valueAsNumberFor("2009-12-22T11:32:11Z") is Date.UTC(2009, 11, 22, 11, 32, 11)
PASS setValueAsNumberAndGetValue(1969, 11, 1, 0, 0, 0, 0) is "1969-12-01T00:00Z"
PASS setValueAsNumberAndGetValue(1970, 0, 1, 10, 1, 0, 100) is "1970-01-01T10:01:00.100Z"
PASS setValueAsNumberAndGetValue(2009, 11, 31, 23, 59, 59, 999) is "2009-12-31T23:59:59.999Z"
PASS setValueAsNumberAndGetValue(10000, 0, 1, 12, 0, 1, 0) is "10000-01-01T12:00:01Z"
PASS setValueAsNumberAndGetValue(-1, 0, 1, 0, 0, 0, 0) is ""
PASS setValueAsNumberAndGetValue(0, 11, 31, 23, 59, 59, 999) is ""
PASS setValueAsNumberAndGetValue(1, 0, 1, 0, 0, 0, 0) is "0001-01-01T00:00Z"
PASS setValueAsNumberAndGetValue(275760, 8, 12, 0, 0, 0, 1) is "275760-09-12T00:00:00.001Z"
PASS setValueAsNumberAndGetValue(275760, 8, 13, 0, 0, 0, 0) is "275760-09-13T00:00Z"
Tests to set invalid values to valueAsNumber:
PASS input.value = ""; input.valueAsNumber = null; input.value is "1970-01-01T00:00Z"
PASS input.valueAsNumber = "foo" threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS input.valueAsNumber = NaN threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS input.valueAsNumber = Number.NaN threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS input.valueAsNumber = Infinity threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS input.valueAsNumber = Number.POSITIVE_INFINITY threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS input.valueAsNumber = Number.NEGATIVE_INFINITY threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
PASS input.valueAsNumber = Date.UTC(275760, 8, 13, 0, 0, 0, 1) threw exception NotSupportedError (DOM Exception 9): The operation is not supported..
Step attribute value and string representation:
PASS input.step = "1"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0, 0) is "2010-01-21T00:00Z"
PASS input.step = "0.001"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0, 0) is "2010-01-21T00:00Z"
PASS successfullyParsed is true
TEST COMPLETE