| 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=time id=time value="00:00" step="3600" list=suggestions> | |
| 12 <datalist id=suggestions> | |
| 13 <option>01:00</option> | |
| 14 <option>01:00:01</option> | |
| 15 <option>01:00:01.001</option> | |
| 16 <option>01:00:01.010</option> | |
| 17 <option>01:01</option> | |
| 18 <option>02:00</option> | |
| 19 <option>02: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 timeElement = document.getElementById('time'); | |
| 28 | |
| 29 window.onload = function() { | |
| 30 openPicker(timeElement, test1); | |
| 31 }; | |
| 32 | |
| 33 function test1() { | |
| 34 popupWindow.focus(); | |
| 35 | |
| 36 shouldBe('entryValues().length', '2'); | |
| 37 shouldBeEqualToString('entryValues()[0]', '01:00'); | |
| 38 shouldBeEqualToString('entryValues()[1]', '02:00'); | |
| 39 | |
| 40 eventSender.keyDown('\x1B'); // Close picker. | |
| 41 waitUntilClosing(test1AfterClosing); | |
| 42 } | |
| 43 | |
| 44 function test1AfterClosing() { | |
| 45 timeElement.step = 60; | |
| 46 openPicker(timeElement, test2); | |
| 47 } | |
| 48 | |
| 49 function test2() { | |
| 50 popupWindow.focus(); | |
| 51 | |
| 52 shouldBe('entryValues().length', '4'); | |
| 53 shouldBeEqualToString('entryValues()[0]', '01:00'); | |
| 54 shouldBeEqualToString('entryValues()[1]', '01:01'); | |
| 55 shouldBeEqualToString('entryValues()[2]', '02:00'); | |
| 56 shouldBeEqualToString('entryValues()[3]', '02:01'); | |
| 57 | |
| 58 eventSender.keyDown('\x1B'); // Close picker. | |
| 59 waitUntilClosing(test2AfterClosing); | |
| 60 } | |
| 61 | |
| 62 function test2AfterClosing() { | |
| 63 timeElement.step = 1; | |
| 64 openPicker(timeElement, test3); | |
| 65 } | |
| 66 | |
| 67 function test3() { | |
| 68 popupWindow.focus(); | |
| 69 | |
| 70 shouldBe('entryValues().length', '5'); | |
| 71 shouldBeEqualToString('entryValues()[0]', '01:00'); | |
| 72 shouldBeEqualToString('entryValues()[1]', '01:00:01'); | |
| 73 shouldBeEqualToString('entryValues()[2]', '01:01'); | |
| 74 shouldBeEqualToString('entryValues()[3]', '02:00'); | |
| 75 shouldBeEqualToString('entryValues()[4]', '02:01'); | |
| 76 | |
| 77 eventSender.keyDown('\x1B'); // Close picker. | |
| 78 waitUntilClosing(test3AfterClosing); | |
| 79 } | |
| 80 | |
| 81 function test3AfterClosing() { | |
| 82 timeElement.step = 0.001; | |
| 83 openPicker(timeElement, test4); | |
| 84 } | |
| 85 | |
| 86 function test4() { | |
| 87 popupWindow.focus(); | |
| 88 | |
| 89 shouldBe('entryValues().length', '7'); | |
| 90 shouldBeEqualToString('entryValues()[0]', '01:00'); | |
| 91 shouldBeEqualToString('entryValues()[1]', '01:00:01'); | |
| 92 shouldBeEqualToString('entryValues()[2]', '01:00:01.001'); | |
| 93 shouldBeEqualToString('entryValues()[3]', '01:00:01.010'); | |
| 94 shouldBeEqualToString('entryValues()[4]', '01:01'); | |
| 95 shouldBeEqualToString('entryValues()[5]', '02:00'); | |
| 96 shouldBeEqualToString('entryValues()[6]', '02:01'); | |
| 97 | |
| 98 finishJSTest(); | |
| 99 } | |
| 100 | |
| 101 </script> | |
| 102 <script src="../../../../../fast/js/resources/js-test-post.js"></script> | |
| 103 </body> | |
| 104 </html> | |
| OLD | NEW |