4 <script src="../../js/resources/js-test-pre.js"></script>
7 <p id="description"></p>
8 <div id="console"></div>
10 description('Check stepUp() and stepDown() bahevior for type=time.');
12 var input = document.createElement('input');
13 var invalidStateErr = '"Error: INVALID_STATE_ERR: DOM Exception 11"';
15 function setInputAttributes(min, max, step, value) {
22 function stepUp(value, step, max, optionalStepCount) {
23 setInputAttributes(null, max, step, value);
24 if (typeof optionalStepCount != "undefined")
25 input.stepUp(optionalStepCount);
31 function stepDown(value, step, min, optionalStepCount) {
32 setInputAttributes(min, null, step, value);
33 if (typeof optionalStepCount != "undefined")
34 input.stepDown(optionalStepCount);
41 debug('Invalid value');
42 shouldThrow('stepUp("", null, null)', invalidStateErr);
43 shouldThrow('stepDown("", null, null)', invalidStateErr);
44 debug('Non-number arguments');
45 shouldBe('stepUp("20:13", null, null, "0")', '"20:13"');
46 shouldBe('stepDown("20:13", null, null, "0")', '"20:13"');
47 shouldBe('stepUp("20:13", null, null, "foo")', '"20:13"');
48 shouldBe('stepDown("20:13", null, null, "foo")', '"20:13"');
49 shouldBe('stepUp("20:13", null, null, null)', '"20:13"');
50 shouldBe('stepDown("20:13", null, null, null)', '"20:13"');
51 debug('Normal cases');
52 shouldBe('stepUp("20:13", null, null)', '"20:14"');
53 shouldBe('stepDown("20:13", null, null)', '"20:12"');
54 shouldBe('stepUp("20:13", null, null, 10)', '"20:23"');
55 shouldBe('stepDown("20:13", null, null, 11)', '"20:02"');
56 shouldBe('stepUp("20:13", "4", null, 2)', '"20:13:08"');
57 shouldBe('stepDown("20:13", "4", null, 3)', '"20:12:48"');
59 shouldThrow('stepUp("20:13", "any", null)', invalidStateErr);
60 shouldThrow('stepDown("20:13", "any", null)', invalidStateErr);
61 debug('Overflow/underflow');
62 shouldThrow('stepUp("20:13", "3.40282346e+38", null)', invalidStateErr);
63 shouldThrow('stepDown("20:13", "3.40282346e+38", null)', invalidStateErr);
64 shouldThrow('stepUp("20:13", "1", "20:13")', invalidStateErr);
65 shouldThrow('stepDown("20:13", "1", "20:13")', invalidStateErr);
66 shouldThrow('stepUp("23:59", null, null)', invalidStateErr);
67 shouldThrow('stepDown("00:00", null, null)', invalidStateErr);
71 <script src="../../js/resources/js-test-post.js"></script>