| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../../../fast/js/resources/js-test-pre.js"></script> | |
| 5 <script src="../../../../../fast/forms/resources/picker-common.js"></script> | |
| 6 <script src="resources/suggestion-picker-common.js"></script> | |
| 7 </head> | |
| 8 <body style="background-color: #bbbbbb;"> | |
| 9 <p id="description"></p> | |
| 10 <div id="console"></div> | |
| 11 <input type=datetime-local id=datetime-local value="2012-11-22T00:00" step="3600
" list=suggestions> | |
| 12 <datalist id=suggestions> | |
| 13 <option>2012-11-22T01:00</option> | |
| 14 <option>2012-11-22T01:00:01</option> | |
| 15 <option>2012-11-22T01:00:01.001</option> | |
| 16 <option>2012-11-22T01:00:01.010</option> | |
| 17 <option>2012-11-22T01:01</option> | |
| 18 <option>2012-11-22T02:00</option> | |
| 19 <option>2012-11-22T02:01</option> | |
| 20 </datalist> | |
| 21 <script> | |
| 22 description('Tests that step attribute filter out suggestions as expected.'); | |
| 23 | |
| 24 debug('Check that page popup doesn\'t exist at first.'); | |
| 25 shouldBeNull('document.getElementById("mock-page-popup")'); | |
| 26 | |
| 27 var datetimeLocalElement = document.getElementById('datetime-local'); | |
| 28 | |
| 29 window.onload = function() { | |
| 30 openPicker(datetimeLocalElement, test1); | |
| 31 }; | |
| 32 | |
| 33 function test1() { | |
| 34 popupWindow.focus(); | |
| 35 | |
| 36 shouldBe('entryValues().length', '3'); | |
| 37 shouldBeEqualToString('entryValues()[0]', '2012-11-22T01:00'); | |
| 38 shouldBeEqualToString('entryValues()[1]', '2012-11-22T02:00'); | |
| 39 shouldBeEqualToString('entryValues()[2]', '@openCalendarPicker'); | |
| 40 | |
| 41 eventSender.keyDown('\x1B'); // Close picker. | |
| 42 waitUntilClosing(test1AfterClosing); | |
| 43 } | |
| 44 | |
| 45 function test1AfterClosing() { | |
| 46 datetimeLocalElement.step = 60; | |
| 47 openPicker(datetimeLocalElement, test2); | |
| 48 } | |
| 49 | |
| 50 function test2() { | |
| 51 popupWindow.focus(); | |
| 52 | |
| 53 shouldBe('entryValues().length', '5'); | |
| 54 shouldBeEqualToString('entryValues()[0]', '2012-11-22T01:00'); | |
| 55 shouldBeEqualToString('entryValues()[1]', '2012-11-22T01:01'); | |
| 56 shouldBeEqualToString('entryValues()[2]', '2012-11-22T02:00'); | |
| 57 shouldBeEqualToString('entryValues()[3]', '2012-11-22T02:01'); | |
| 58 shouldBeEqualToString('entryValues()[4]', '@openCalendarPicker'); | |
| 59 | |
| 60 eventSender.keyDown('\x1B'); // Close picker. | |
| 61 waitUntilClosing(test2AfterClosing); | |
| 62 } | |
| 63 | |
| 64 function test2AfterClosing() { | |
| 65 datetimeLocalElement.step = 1; | |
| 66 openPicker(datetimeLocalElement, test3); | |
| 67 } | |
| 68 | |
| 69 function test3() { | |
| 70 popupWindow.focus(); | |
| 71 | |
| 72 shouldBe('entryValues().length', '6'); | |
| 73 shouldBeEqualToString('entryValues()[0]', '2012-11-22T01:00'); | |
| 74 shouldBeEqualToString('entryValues()[1]', '2012-11-22T01:00:01'); | |
| 75 shouldBeEqualToString('entryValues()[2]', '2012-11-22T01:01'); | |
| 76 shouldBeEqualToString('entryValues()[3]', '2012-11-22T02:00'); | |
| 77 shouldBeEqualToString('entryValues()[4]', '2012-11-22T02:01'); | |
| 78 shouldBeEqualToString('entryValues()[5]', '@openCalendarPicker'); | |
| 79 | |
| 80 eventSender.keyDown('\x1B'); // Close picker. | |
| 81 waitUntilClosing(test3AfterClosing); | |
| 82 } | |
| 83 | |
| 84 function test3AfterClosing() { | |
| 85 datetimeLocalElement.step = 0.001; | |
| 86 openPicker(datetimeLocalElement, test4); | |
| 87 } | |
| 88 | |
| 89 function test4() { | |
| 90 popupWindow.focus(); | |
| 91 | |
| 92 shouldBe('entryValues().length', '8'); | |
| 93 shouldBeEqualToString('entryValues()[0]', '2012-11-22T01:00'); | |
| 94 shouldBeEqualToString('entryValues()[1]', '2012-11-22T01:00:01'); | |
| 95 shouldBeEqualToString('entryValues()[2]', '2012-11-22T01:00:01.001'); | |
| 96 shouldBeEqualToString('entryValues()[3]', '2012-11-22T01:00:01.010'); | |
| 97 shouldBeEqualToString('entryValues()[4]', '2012-11-22T01:01'); | |
| 98 shouldBeEqualToString('entryValues()[5]', '2012-11-22T02:00'); | |
| 99 shouldBeEqualToString('entryValues()[6]', '2012-11-22T02:01'); | |
| 100 shouldBeEqualToString('entryValues()[7]', '@openCalendarPicker'); | |
| 101 | |
| 102 finishJSTest(); | |
| 103 } | |
| 104 | |
| 105 </script> | |
| 106 <script src="../../../../../fast/js/resources/js-test-post.js"></script> | |
| 107 </body> | |
| 108 </html> | |
| OLD | NEW |