OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <script> | 9 <script> |
10 description('Tests for .valueAsNumber with <input type=datetime-local>.'); | 10 description('Tests for .valueAsNumber with <input type=datetime-local>.'); |
(...skipping 26 matching lines...) Expand all Loading... |
37 shouldBe('setValueAsNumberAndGetValue(10000, 0, 1, 12, 0, 1, 0)', '"10000-01-01T
12:00:01"'); | 37 shouldBe('setValueAsNumberAndGetValue(10000, 0, 1, 12, 0, 1, 0)', '"10000-01-01T
12:00:01"'); |
38 | 38 |
39 shouldBe('setValueAsNumberAndGetValue(-1, 0, 1, 0, 0, 0, 0)', '""'); | 39 shouldBe('setValueAsNumberAndGetValue(-1, 0, 1, 0, 0, 0, 0)', '""'); |
40 shouldBe('setValueAsNumberAndGetValue(0, 11, 31, 23, 59, 59, 999)', '""'); | 40 shouldBe('setValueAsNumberAndGetValue(0, 11, 31, 23, 59, 59, 999)', '""'); |
41 shouldBe('setValueAsNumberAndGetValue(1, 0, 1, 0, 0, 0, 0)', '"0001-01-01T00:00"
'); | 41 shouldBe('setValueAsNumberAndGetValue(1, 0, 1, 0, 0, 0, 0)', '"0001-01-01T00:00"
'); |
42 shouldBe('setValueAsNumberAndGetValue(275760, 8, 12, 0, 0, 0, 1)', '"275760-09-1
2T00:00:00.001"'); | 42 shouldBe('setValueAsNumberAndGetValue(275760, 8, 12, 0, 0, 0, 1)', '"275760-09-1
2T00:00:00.001"'); |
43 shouldBe('setValueAsNumberAndGetValue(275760, 8, 13, 0, 0, 0, 0)', '"275760-09-1
3T00:00"'); | 43 shouldBe('setValueAsNumberAndGetValue(275760, 8, 13, 0, 0, 0, 0)', '"275760-09-1
3T00:00"'); |
44 | 44 |
45 debug('Tests to set invalid values to valueAsNumber:'); | 45 debug('Tests to set invalid values to valueAsNumber:'); |
46 shouldBe('input.value = ""; input.valueAsNumber = null; input.value', '"1970-01-
01T00:00"'); | 46 shouldBe('input.value = ""; input.valueAsNumber = null; input.value', '"1970-01-
01T00:00"'); |
47 shouldThrow('input.valueAsNumber = "foo"', '"Error: NotSupportedError: DOM Excep
tion 9"'); | 47 shouldThrow('input.valueAsNumber = "foo"', '"NotSupportedError: The implementati
on did not support the requested type of object or operation."'); |
48 shouldThrow('input.valueAsNumber = NaN', '"Error: NotSupportedError: DOM Excepti
on 9"'); | 48 shouldThrow('input.valueAsNumber = NaN', '"NotSupportedError: The implementation
did not support the requested type of object or operation."'); |
49 shouldThrow('input.valueAsNumber = Number.NaN', '"Error: NotSupportedError: DOM
Exception 9"'); | 49 shouldThrow('input.valueAsNumber = Number.NaN', '"NotSupportedError: The impleme
ntation did not support the requested type of object or operation."'); |
50 shouldThrow('input.valueAsNumber = Infinity', '"Error: NotSupportedError: DOM Ex
ception 9"'); | 50 shouldThrow('input.valueAsNumber = Infinity', '"NotSupportedError: The implement
ation did not support the requested type of object or operation."'); |
51 shouldThrow('input.valueAsNumber = Number.POSITIVE_INFINITY', '"Error: NotSuppor
tedError: DOM Exception 9"'); | 51 shouldThrow('input.valueAsNumber = Number.POSITIVE_INFINITY', '"NotSupportedErro
r: The implementation did not support the requested type of object or operation.
"'); |
52 shouldThrow('input.valueAsNumber = Number.NEGATIVE_INFINITY', '"Error: NotSuppor
tedError: DOM Exception 9"'); | 52 shouldThrow('input.valueAsNumber = Number.NEGATIVE_INFINITY', '"NotSupportedErro
r: The implementation did not support the requested type of object or operation.
"'); |
53 shouldThrow('input.valueAsNumber = Date.UTC(275760, 8, 13, 0, 0, 0, 1)', '"Error
: NotSupportedError: DOM Exception 9"'); | 53 shouldThrow('input.valueAsNumber = Date.UTC(275760, 8, 13, 0, 0, 0, 1)', '"NotSu
pportedError: The implementation did not support the requested type of object or
operation."'); |
54 | 54 |
55 debug('Step attribute value and string representation:'); | 55 debug('Step attribute value and string representation:'); |
56 // If the step attribute value is 1 second and the second part is 0, we should s
how the second part. | 56 // If the step attribute value is 1 second and the second part is 0, we should s
how the second part. |
57 shouldBe('input.step = "1"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0, 0)
', '"2010-01-21T00:00:00"'); | 57 shouldBe('input.step = "1"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0, 0)
', '"2010-01-21T00:00:00"'); |
58 // If the step attribute value is 0.001 second and the millisecond part is 0, we
should show the millisecond part. | 58 // If the step attribute value is 0.001 second and the millisecond part is 0, we
should show the millisecond part. |
59 shouldBe('input.step = "0.001"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0
, 0)', '"2010-01-21T00:00:00.000"'); | 59 shouldBe('input.step = "0.001"; setValueAsNumberAndGetValue(2010, 0, 21, 0, 0, 0
, 0)', '"2010-01-21T00:00:00.000"'); |
60 </script> | 60 </script> |
61 <script src="../../js/resources/js-test-post.js"></script> | 61 <script src="../../js/resources/js-test-post.js"></script> |
62 </body> | 62 </body> |
63 </html> | 63 </html> |
OLD | NEW |