| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| description('Check stepMismatch results for type=time.'); |
| |
| var input = document.createElement('input'); |
| document.body.appendChild(input); |
| |
| function stepMismatchFor(value, step, min, disabled) { |
| input.min = min; |
| input.step = step; |
| input.value = value; |
| input.disabled = !!disabled; |
| return input.validity.stepMismatch; |
| } |
| |
| input.type = 'time'; |
| debug('Empty values'); |
| shouldBeFalse('stepMismatchFor("", null, null)'); |
| shouldBeFalse('stepMismatchFor("", "2", "12:34:56")'); |
| debug('Normal step values'); |
| shouldBeFalse('stepMismatchFor("12:34:55", "1", "12:34:56")'); |
| shouldBeTrue('stepMismatchFor("12:34:55.001", "1", "12:34:56")'); |
| shouldBeFalse('stepMismatchFor("12:34:56.001", "0.001", "12:34:56")'); |
| shouldBeTrue('stepMismatchFor("12:34:55", "0.333", "12:34:56")'); |
| shouldBeFalse('stepMismatchFor("12:34:55.001", "0.333", "12:34:56")'); |
| shouldBeFalse('stepMismatchFor("12:34", "86400", "12:34")'); |
| shouldBeTrue('stepMismatchFor("23:59:59.998", "86399.999", "00:00")'); |
| shouldBeFalse('stepMismatchFor("23:59:59.999", "86399.999", "00:00")'); |
| debug('Implicit step base'); |
| shouldBeFalse('stepMismatchFor("12:34", "120", null)'); |
| shouldBeTrue('stepMismatchFor("12:35", "120", null)'); |
| debug('Small step values'); |
| shouldBeFalse('stepMismatchFor("12:34:55.001", "0.0003", "12:34.55.000")'); |
| shouldBeTrue('stepMismatchFor("12:34:55.001", "0.0019", "12:34.55.000")'); |
| shouldBeFalse('stepMismatchFor("12:34:55.004", "0.0019", "12:34.55.000")'); |
| debug('Invalid or no step values'); |
| shouldBeFalse('stepMismatchFor("12:34", null, "12:34")'); |
| shouldBeTrue('stepMismatchFor("12:34:56", null, "12:34")'); |
| shouldBeFalse('stepMismatchFor("12:34", "-1", "12:34")'); |
| shouldBeFalse('stepMismatchFor("12:34", "foo", "12:34")'); |
| debug('Special step value'); |
| shouldBeFalse('stepMismatchFor("12:35", "any", "12:34")'); |
| debug('Disabled'); |
| shouldBeFalse('stepMismatchFor("12:34:55.001", "1", "12:34:56", true)'); |
| |
| debug(''); |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |