OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.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=month>.'); | 10 description('Tests for .valueAsNumber with <input type=month>.'); |
(...skipping 29 matching lines...) Expand all Loading... |
40 shouldBe('setValueAsNumberAndGetValue(1, 1)', '"0001-01"'); | 40 shouldBe('setValueAsNumberAndGetValue(1, 1)', '"0001-01"'); |
41 shouldBe('setValueAsNumberAndGetValue(1, 2)', '"0001-02"'); | 41 shouldBe('setValueAsNumberAndGetValue(1, 2)', '"0001-02"'); |
42 shouldBe('setValueAsNumberAndGetValue(275760, 9)', '"275760-09"'); | 42 shouldBe('setValueAsNumberAndGetValue(275760, 9)', '"275760-09"'); |
43 shouldBe('setValueAsNumberAndGetValue(275760, 10)', '""'); | 43 shouldBe('setValueAsNumberAndGetValue(275760, 10)', '""'); |
44 | 44 |
45 // Date.UTC() of V8 throws an exception for the following value though JavaScrip
tCore doesn't. | 45 // Date.UTC() of V8 throws an exception for the following value though JavaScrip
tCore doesn't. |
46 // shouldBe('setValueAsNumberAndGetValue(275760, 8, 14)', '"275760-09"'); | 46 // shouldBe('setValueAsNumberAndGetValue(275760, 8, 14)', '"275760-09"'); |
47 | 47 |
48 debug('Tests to set invalid values to valueAsNumber:'); | 48 debug('Tests to set invalid values to valueAsNumber:'); |
49 shouldBe('input.value = ""; input.valueAsNumber = null; input.value', '"1970-01"
'); | 49 shouldBe('input.value = ""; input.valueAsNumber = null; input.value', '"1970-01"
'); |
50 shouldThrow('input.valueAsNumber = "foo"', '"NotSupportedError: Failed to set th
e \'valueAsNumber\' property on \'HTMLInputElement\': The value provided is not
a number."'); | 50 shouldBeNaN('input.valueAsNumber = "foo"; input.valueAsNumber'); |
51 shouldThrow('input.valueAsNumber = NaN', '"NotSupportedError: Failed to set the
\'valueAsNumber\' property on \'HTMLInputElement\': The value provided is not a
number."'); | 51 shouldBeEqualToString('input.valueAsNumber = "foo"; input.value', ''); |
52 shouldThrow('input.valueAsNumber = Number.NaN', '"NotSupportedError: Failed to s
et the \'valueAsNumber\' property on \'HTMLInputElement\': The value provided is
not a number."'); | 52 shouldBeNaN('input.valueAsNumber = NaN; input.valueAsNumber'); |
53 shouldThrow('input.valueAsNumber = Infinity', '"NotSupportedError: Failed to set
the \'valueAsNumber\' property on \'HTMLInputElement\': The value provided is i
nfinite."'); | 53 shouldBeEqualToString('input.valueAsNumber = NaN; input.value', ''); |
54 shouldThrow('input.valueAsNumber = Number.POSITIVE_INFINITY', '"NotSupportedErro
r: Failed to set the \'valueAsNumber\' property on \'HTMLInputElement\': The val
ue provided is infinite."'); | 54 shouldBeNaN('input.valueAsNumber = Number.NaN; input.valueAsNumber'); |
55 shouldThrow('input.valueAsNumber = Number.NEGATIVE_INFINITY', '"NotSupportedErro
r: Failed to set the \'valueAsNumber\' property on \'HTMLInputElement\': The val
ue provided is infinite."'); | 55 shouldBeEqualToString('input.valueAsNumber = Number.NaN; input.value', ''); |
| 56 shouldThrow('input.valueAsNumber = Infinity', '"TypeError: Failed to set the \'v
alueAsNumber\' property on \'HTMLInputElement\': The value provided is infinite.
"'); |
| 57 shouldThrow('input.valueAsNumber = Number.POSITIVE_INFINITY', '"TypeError: Faile
d to set the \'valueAsNumber\' property on \'HTMLInputElement\': The value provi
ded is infinite."'); |
| 58 shouldThrow('input.valueAsNumber = Number.NEGATIVE_INFINITY', '"TypeError: Faile
d to set the \'valueAsNumber\' property on \'HTMLInputElement\': The value provi
ded is infinite."'); |
56 </script> | 59 </script> |
57 </body> | 60 </body> |
58 </html> | 61 </html> |
OLD | NEW |