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