OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../../../fast/js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description('Tests for .valueAsNumber with <input type=number>.'); | 8 description('Tests for .valueAsNumber with <input type=number>.'); |
9 | 9 |
10 var input = document.createElement('input'); | 10 var input = document.createElement('input'); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 debug('Tests for the valueAsNumber setter:'); | 55 debug('Tests for the valueAsNumber setter:'); |
56 shouldBe('setValueAsNumberAndGetValue(0)', '"0"'); | 56 shouldBe('setValueAsNumberAndGetValue(0)', '"0"'); |
57 shouldBe('setValueAsNumberAndGetValue(10)', '"10"'); | 57 shouldBe('setValueAsNumberAndGetValue(10)', '"10"'); |
58 shouldBe('setValueAsNumberAndGetValue(01)', '"1"'); | 58 shouldBe('setValueAsNumberAndGetValue(01)', '"1"'); |
59 shouldBe('setValueAsNumberAndGetValue(-0)', '"0"'); | 59 shouldBe('setValueAsNumberAndGetValue(-0)', '"0"'); |
60 shouldBe('setValueAsNumberAndGetValue(-1.2)', '"-1.2"'); | 60 shouldBe('setValueAsNumberAndGetValue(-1.2)', '"-1.2"'); |
61 shouldBe('setValueAsNumberAndGetValue(1.2e10)', '"12000000000"'); | 61 shouldBe('setValueAsNumberAndGetValue(1.2e10)', '"12000000000"'); |
62 shouldBe('setValueAsNumberAndGetValue(1.2e-10)', '"1.2e-10"'); | 62 shouldBe('setValueAsNumberAndGetValue(1.2e-10)', '"1.2e-10"'); |
63 shouldBe('setValueAsNumberAndGetValue(1.2345678901234567e+38)', '"1.234567890123
4567e+38"'); | 63 shouldBe('setValueAsNumberAndGetValue(1.2345678901234567e+38)', '"1.234567890123
4567e+38"'); |
64 shouldBe('setValueAsNumberAndGetValue("-3.40282346e+38")', '"-3.40282346e+38"'); | 64 shouldBe('setValueAsNumberAndGetValue("-3.40282346e+38")', '"-3.40282346e+38"'); |
65 shouldThrow('setValueAsNumberAndGetValue("-3.40282348e+38")', '"Error: InvalidSt
ateError: DOM Exception 11"'); | 65 shouldThrow('setValueAsNumberAndGetValue("-3.40282348e+38")', '"InvalidStateErro
r: An attempt was made to use an object that is not, or is no longer, usable."')
; |
66 shouldBe('setValueAsNumberAndGetValue("3.40282346e+38")', '"3.40282346e+38"'); | 66 shouldBe('setValueAsNumberAndGetValue("3.40282346e+38")', '"3.40282346e+38"'); |
67 shouldThrow('setValueAsNumberAndGetValue("3.40282348e+38")', '"Error: InvalidSta
teError: DOM Exception 11"'); | 67 shouldThrow('setValueAsNumberAndGetValue("3.40282348e+38")', '"InvalidStateError
: An attempt was made to use an object that is not, or is no longer, usable."'); |
68 | 68 |
69 debug('Tests to set invalid values to valueAsNumber:'); | 69 debug('Tests to set invalid values to valueAsNumber:'); |
70 shouldBe('setValueAsNumberAndGetValue(null)', '"0"'); | 70 shouldBe('setValueAsNumberAndGetValue(null)', '"0"'); |
71 shouldThrow('setValueAsNumberAndGetValue("foo")', '"Error: NotSupportedError: DO
M Exception 9"'); | 71 shouldThrow('setValueAsNumberAndGetValue("foo")', '"NotSupportedError: The imple
mentation did not support the requested type of object or operation."'); |
72 shouldThrow('setValueAsNumberAndGetValue(NaN)', '"Error: NotSupportedError: DOM
Exception 9"'); | 72 shouldThrow('setValueAsNumberAndGetValue(NaN)', '"NotSupportedError: The impleme
ntation did not support the requested type of object or operation."'); |
73 shouldThrow('setValueAsNumberAndGetValue(Number.NaN)', '"Error: NotSupportedErro
r: DOM Exception 9"'); | 73 shouldThrow('setValueAsNumberAndGetValue(Number.NaN)', '"NotSupportedError: The
implementation did not support the requested type of object or operation."'); |
74 shouldThrow('setValueAsNumberAndGetValue(Infinity)', '"Error: NotSupportedError:
DOM Exception 9"'); | 74 shouldThrow('setValueAsNumberAndGetValue(Infinity)', '"NotSupportedError: The im
plementation did not support the requested type of object or operation."'); |
75 shouldThrow('setValueAsNumberAndGetValue(Number.POSITIVE_INFINITY)', '"Error: No
tSupportedError: DOM Exception 9"'); | 75 shouldThrow('setValueAsNumberAndGetValue(Number.POSITIVE_INFINITY)', '"NotSuppor
tedError: The implementation did not support the requested type of object or ope
ration."'); |
76 shouldThrow('setValueAsNumberAndGetValue(Number.NEGATIVE_INFINITY)', '"Error: No
tSupportedError: DOM Exception 9"'); | 76 shouldThrow('setValueAsNumberAndGetValue(Number.NEGATIVE_INFINITY)', '"NotSuppor
tedError: The implementation did not support the requested type of object or ope
ration."'); |
77 </script> | 77 </script> |
78 <script src="../../../fast/js/resources/js-test-post.js"></script> | 78 <script src="../../../fast/js/resources/js-test-post.js"></script> |
79 </body> | 79 </body> |
80 </html> | 80 </html> |
OLD | NEW |