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 <input type="datetime-local" id="datetime-bare" step="302400"/> |
12 | 12 |
13 <script> | 13 <script> |
14 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.'); |
15 | 15 |
16 document.getElementById('datetime-bare').value = '2012-11-20T00:00'; | 16 document.getElementById('datetime-bare').value = '2012-11-20T00:00'; |
17 openPicker(document.getElementById('datetime-bare'), test1); | 17 openPicker(document.getElementById('datetime-bare'), test1); |
18 | 18 |
19 function test1() { | 19 function test1() { |
20 debug("Step without value, min nor max attributes."); | 20 debug("Step without value, min nor max attributes."); |
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'
); | 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'
); |
22 | 22 |
23 // Close popup | 23 // Close popup |
24 eventSender.keyDown('\x1B'); | 24 eventSender.keyDown('escape'); |
25 waitUntilClosing(test1AfterClose); | 25 waitUntilClosing(test1AfterClose); |
26 } | 26 } |
27 | 27 |
28 function test1AfterClose() { | 28 function test1AfterClose() { |
29 openPicker(document.getElementById('datetime'), test2); | 29 openPicker(document.getElementById('datetime'), test2); |
30 } | 30 } |
31 | 31 |
32 function test2() { | 32 function test2() { |
33 debug("Step without min or max."); | 33 debug("Step without min or max."); |
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'
); | 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'
); |
35 | 35 |
36 // Close popup | 36 // Close popup |
37 eventSender.keyDown('\x1B'); | 37 eventSender.keyDown('escape'); |
38 waitUntilClosing(test2AfterClose); | 38 waitUntilClosing(test2AfterClose); |
39 } | 39 } |
40 | 40 |
41 function test2AfterClose() { | 41 function test2AfterClose() { |
42 document.getElementById('datetime').min = '2012-11-16T12:00'; | 42 document.getElementById('datetime').min = '2012-11-16T12:00'; |
43 | 43 |
44 // Reopen popup | 44 // Reopen popup |
45 openPicker(document.getElementById('datetime'), test3); | 45 openPicker(document.getElementById('datetime'), test3); |
46 } | 46 } |
47 | 47 |
48 function test3() { | 48 function test3() { |
49 debug("Step when min is set."); | 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'); | 50 shouldBeEqualToString('availableDayCells()', '2012-11-16,2012-11-20,2012-11-
23,2012-11-27,2012-11-30'); |
51 | 51 |
52 // Close popup | 52 // Close popup |
53 eventSender.keyDown('\x1B'); | 53 eventSender.keyDown('escape'); |
54 waitUntilClosing(test3AfterClose); | 54 waitUntilClosing(test3AfterClose); |
55 } | 55 } |
56 | 56 |
57 function test3AfterClose() { | 57 function test3AfterClose() { |
58 document.getElementById('datetime').max = '2012-11-20T00:00'; | 58 document.getElementById('datetime').max = '2012-11-20T00:00'; |
59 | 59 |
60 // Reopen popup | 60 // Reopen popup |
61 openPicker(document.getElementById('datetime'), test4); | 61 openPicker(document.getElementById('datetime'), test4); |
62 } | 62 } |
63 | 63 |
64 function test4() { | 64 function test4() { |
65 debug("Step when min and max are set."); | 65 debug("Step when min and max are set."); |
66 shouldBeEqualToString('availableDayCells()', '2012-11-16,2012-11-20'); | 66 shouldBeEqualToString('availableDayCells()', '2012-11-16,2012-11-20'); |
67 finishJSTest(); | 67 finishJSTest(); |
68 } | 68 } |
69 | 69 |
70 </script> | 70 </script> |
71 </body> | 71 </body> |
72 </html> | 72 </html> |
OLD | NEW |