OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script src="../resources/picker-common.js"></script> | 5 <script src="../resources/picker-common.js"></script> |
6 <script src="resources/calendar-picker-common.js"></script> | 6 <script src="resources/calendar-picker-common.js"></script> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 | 9 |
10 <input type="datetime-local" id="datetime" value="2012-11-20T00:00" step="302400
"/> | 10 <input type="datetime-local" id="datetime" value="2012-11-20T00:00" step="302400
"/> |
| 11 <input type="datetime-local" id="datetime-bare" step="302400"/> |
11 | 12 |
12 <script> | 13 <script> |
13 description('Test if step limits available dates in calendar picker on datetime
input.'); | 14 description('Test if step limits available dates in calendar picker on datetime
input.'); |
14 | 15 |
15 openPicker(document.getElementById('datetime'), test1); | 16 document.getElementById('datetime-bare').value = '2012-11-20T00:00'; |
| 17 openPicker(document.getElementById('datetime-bare'), test1); |
16 | 18 |
17 function test1() { | 19 function test1() { |
18 debug("Step without min or max."); | 20 debug("Step without value, min nor max attributes."); |
19 shouldBeEqualToString('availableDayCells()', '2012-10-28,2012-11-01,2012-11-
04,2012-11-08,2012-11-11,2012-11-15,2012-11-18,2012-11-22,2012-11-25,2012-11-29'
); | 21 shouldBeEqualToString('availableDayCells()', '2012-10-28,2012-11-01,2012-11-
04,2012-11-08,2012-11-11,2012-11-15,2012-11-18,2012-11-22,2012-11-25,2012-11-29'
); |
20 | 22 |
21 // Close popup | 23 // Close popup |
22 eventSender.keyDown('\x1B'); | 24 eventSender.keyDown('\x1B'); |
23 waitUntilClosing(test1AfterClose); | 25 waitUntilClosing(test1AfterClose); |
24 } | 26 } |
25 | 27 |
26 function test1AfterClose() { | 28 function test1AfterClose() { |
27 document.getElementById('datetime').min = "2012-11-16T12:00"; | |
28 | |
29 // Reopen popup | |
30 openPicker(document.getElementById('datetime'), test2); | 29 openPicker(document.getElementById('datetime'), test2); |
31 } | 30 } |
32 | 31 |
33 function test2() { | 32 function test2() { |
34 debug("Step when min is set."); | 33 debug("Step without min or max."); |
35 shouldBeEqualToString('availableDayCells()', '2012-11-16,2012-11-20,2012-11-
23,2012-11-27,2012-11-30'); | 34 shouldBeEqualToString('availableDayCells()', '2012-10-30,2012-11-02,2012-11-
06,2012-11-09,2012-11-13,2012-11-16,2012-11-20,2012-11-23,2012-11-27,2012-11-30'
); |
36 | 35 |
37 // Close popup | 36 // Close popup |
38 eventSender.keyDown('\x1B'); | 37 eventSender.keyDown('\x1B'); |
39 waitUntilClosing(test2AfterClose); | 38 waitUntilClosing(test2AfterClose); |
40 } | 39 } |
41 | 40 |
42 function test2AfterClose() { | 41 function test2AfterClose() { |
43 document.getElementById('datetime').max = "2012-11-20T00:00"; | 42 document.getElementById('datetime').min = '2012-11-16T12:00'; |
44 | 43 |
45 // Reopen popup | 44 // Reopen popup |
46 openPicker(document.getElementById('datetime'), test3); | 45 openPicker(document.getElementById('datetime'), test3); |
47 } | 46 } |
48 | 47 |
49 function test3() { | 48 function test3() { |
| 49 debug("Step when min is set."); |
| 50 shouldBeEqualToString('availableDayCells()', '2012-11-16,2012-11-20,2012-11-
23,2012-11-27,2012-11-30'); |
| 51 |
| 52 // Close popup |
| 53 eventSender.keyDown('\x1B'); |
| 54 waitUntilClosing(test3AfterClose); |
| 55 } |
| 56 |
| 57 function test3AfterClose() { |
| 58 document.getElementById('datetime').max = '2012-11-20T00:00'; |
| 59 |
| 60 // Reopen popup |
| 61 openPicker(document.getElementById('datetime'), test4); |
| 62 } |
| 63 |
| 64 function test4() { |
50 debug("Step when min and max are set."); | 65 debug("Step when min and max are set."); |
51 shouldBeEqualToString('availableDayCells()', '2012-11-16,2012-11-20'); | 66 shouldBeEqualToString('availableDayCells()', '2012-11-16,2012-11-20'); |
52 finishJSTest(); | 67 finishJSTest(); |
53 } | 68 } |
54 | 69 |
55 </script> | 70 </script> |
56 </body> | 71 </body> |
57 </html> | 72 </html> |
OLD | NEW |