4 <script src=
"../../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description('Check stepMismatch results for type=time.');
12 var input
= document
.createElement('input');
13 document
.body
.appendChild(input
);
15 function stepMismatchFor(value
, step
, min
, disabled
) {
19 input
.disabled
= !!disabled
;
20 return input
.validity
.stepMismatch
;
24 debug('Empty values');
25 shouldBeFalse('stepMismatchFor("", null, null)');
26 shouldBeFalse('stepMismatchFor("", "2", "12:34:56")');
27 debug('Normal step values');
28 shouldBeFalse('stepMismatchFor("12:34:55", "1", "12:34:56")');
29 shouldBeTrue('stepMismatchFor("12:34:55.001", "1", "12:34:56")');
30 shouldBeFalse('stepMismatchFor("12:34:56.001", "0.001", "12:34:56")');
31 shouldBeTrue('stepMismatchFor("12:34:55", "0.333", "12:34:56")');
32 shouldBeFalse('stepMismatchFor("12:34:55.001", "0.333", "12:34:56")');
33 shouldBeFalse('stepMismatchFor("12:34", "86400", "12:34")');
34 shouldBeTrue('stepMismatchFor("23:59:59.998", "86399.999", "00:00")');
35 shouldBeFalse('stepMismatchFor("23:59:59.999", "86399.999", "00:00")');
36 debug('Implicit step base');
37 shouldBeFalse('stepMismatchFor("12:34", "120", null)');
38 shouldBeTrue('stepMismatchFor("12:35", "120", null)');
39 debug('Small step values');
40 shouldBeFalse('stepMismatchFor("12:34:55.001", "0.0003", "12:34.55.000")');
41 shouldBeTrue('stepMismatchFor("12:34:55.001", "0.0019", "12:34.55.000")');
42 shouldBeFalse('stepMismatchFor("12:34:55.004", "0.0019", "12:34.55.000")');
43 debug('Invalid or no step values');
44 shouldBeFalse('stepMismatchFor("12:34", null, "12:34")');
45 shouldBeTrue('stepMismatchFor("12:34:56", null, "12:34")');
46 shouldBeFalse('stepMismatchFor("12:34", "-1", "12:34")');
47 shouldBeFalse('stepMismatchFor("12:34", "foo", "12:34")');
48 debug('Special step value');
49 shouldBeFalse('stepMismatchFor("12:35", "any", "12:34")');
51 shouldBeFalse('stepMismatchFor("12:34:55.001", "1", "12:34:56", true)');