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 <script> | 7 <script> |
8 description('This test aims to check for typeMismatch flag with type=number inpu t fields'); | 8 description('This test aims to check for typeMismatch flag with type=number inpu t fields'); |
9 | 9 |
10 var i = document.createElement('input'); | 10 var i = document.createElement('input'); |
(...skipping 19 matching lines...) Expand all Loading... | |
30 } else if (i.value != expectedValue) { | 30 } else if (i.value != expectedValue) { |
31 testFailed('"' + value + '" was sanitized to "' + i.value + '". It shoul d be ' + expectedValue); | 31 testFailed('"' + value + '" was sanitized to "' + i.value + '". It shoul d be ' + expectedValue); |
32 } else { | 32 } else { |
33 testPassed('"' + value + '" was sanitized to "' + i.value + '".'); | 33 testPassed('"' + value + '" was sanitized to "' + i.value + '".'); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 // Valid values | 37 // Valid values |
38 check('0'); | 38 check('0'); |
39 check('10'); | 39 check('10'); |
40 check(' 10'); | |
tkent
2014/04/14 00:47:37
This test should not be updated. The behavior of
| |
41 check('10 '); | |
40 check('01'); | 42 check('01'); |
41 check('0.2'); | 43 check('0.2'); |
42 check('.2'); | 44 check('.2'); |
43 check('-0'); | 45 check('-0'); |
44 check('-1.2'); | 46 check('-1.2'); |
45 check('1.2E10'); | 47 check('1.2E10'); |
46 check('1.2E-10'); | 48 check('1.2E-10'); |
47 check('1.2E+10'); | 49 check('1.2E+10'); |
48 check('12345678901234567890123456789012345678901234567890'); | 50 check('12345678901234567890123456789012345678901234567890'); |
49 check('0.12345678901234567890123456789012345678901234567890'); | 51 check('0.12345678901234567890123456789012345678901234567890'); |
50 | 52 |
51 // Invalid values | 53 // Invalid values |
52 checkSanitization('abc', ''); | 54 checkSanitization('abc', ''); |
53 checkSanitization('0xff', ''); | 55 checkSanitization('0xff', ''); |
54 | |
55 checkSanitization('+1', ''); | 56 checkSanitization('+1', ''); |
56 checkSanitization(' 10', ''); | |
57 checkSanitization('10 ', ''); | |
58 checkSanitization('1,2', ''); | 57 checkSanitization('1,2', ''); |
59 checkSanitization('1E', ''); | 58 checkSanitization('1E', ''); |
60 checkSanitization('NaN', ''); | 59 checkSanitization('NaN', ''); |
61 checkSanitization('nan', ''); | 60 checkSanitization('nan', ''); |
62 checkSanitization('Inf', ''); | 61 checkSanitization('Inf', ''); |
63 checkSanitization('inf', ''); | 62 checkSanitization('inf', ''); |
64 checkSanitization('Infinity', ''); | 63 checkSanitization('Infinity', ''); |
65 checkSanitization('infinity', ''); | 64 checkSanitization('infinity', ''); |
66 | 65 |
67 // Assume empty string as valid. | 66 // Assume empty string as valid. |
68 check(''); | 67 check(''); |
69 | 68 |
70 // Huge exponent. | 69 // Huge exponent. |
71 checkSanitization('1.2E65535', ''); | 70 checkSanitization('1.2E65535', ''); |
72 | 71 |
73 // The spec doesn't allow, but our implementation does. | 72 // The spec doesn't allow, but our implementation does. |
74 check('1.'); | 73 check('1.'); |
75 check('1.2e10'); | 74 check('1.2e10'); |
76 | 75 |
77 // Disabled | 76 // Disabled |
78 check('invalid', true); | 77 check('invalid', true); |
79 </script> | 78 </script> |
80 </body> | 79 </body> |
81 </html> | 80 </html> |
OLD | NEW |