| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="../../forms/resources/picker-common.js"></script> |
| <script src="resources/suggestion-picker-common.js"></script> |
| </head> |
| <body style="background-color: #bbbbbb;"> |
| <p id="description"></p> |
| <div id="console"></div> |
| <input type=month id=month value="2012-01" step="2" list=suggestions> |
| <datalist id=suggestions> |
| <option>2012-01</option> |
| <option>2012-02</option> |
| <option>2012-03</option> |
| <option>2012-04</option> |
| <option>2012-05</option> |
| <option>2012-06</option> |
| <option>2012-07</option> |
| <option>2012-08</option> |
| <option>2012-09</option> |
| <option>2012-10</option> |
| </datalist> |
| |
| <p id="description" style="opacity: 0"></p> |
| <div id="console" style="opacity: 0"></div> |
| |
| <script> |
| description('Tests that step attribute filters out suggestions as expected.'); |
| |
| debug('Check that page popup doesn\'t exist at first.'); |
| shouldBeNull('document.getElementById("mock-page-popup")'); |
| |
| var dateElement = document.getElementById('month'); |
| |
| window.onload = function() { |
| openPicker(dateElement, test1); |
| } |
| |
| function test1() { |
| popupWindow.focus(); |
| |
| shouldBe('entryValues().length', '6'); |
| shouldBeEqualToString('entryValues()[0]', '2012-01'); |
| shouldBeEqualToString('entryValues()[1]', '2012-03'); |
| shouldBeEqualToString('entryValues()[2]', '2012-05'); |
| shouldBeEqualToString('entryValues()[3]', '2012-07'); |
| shouldBeEqualToString('entryValues()[4]', '2012-09'); |
| shouldBeEqualToString('entryValues()[5]', '@openCalendarPicker'); |
| |
| eventSender.keyDown('Escape'); // Close picker. |
| waitUntilClosing(test1AfterClosing); |
| } |
| |
| function test1AfterClosing() { |
| dateElement.step = 5; |
| openPicker(dateElement, test2); |
| } |
| |
| function test2() { |
| popupWindow.focus(); |
| |
| shouldBe('entryValues().length', '3'); |
| shouldBeEqualToString('entryValues()[0]', '2012-01'); |
| shouldBeEqualToString('entryValues()[1]', '2012-06'); |
| shouldBeEqualToString('entryValues()[2]', '@openCalendarPicker'); |
| |
| eventSender.keyDown('Escape'); // Close picker. |
| waitUntilClosing(test2AfterClosing); |
| } |
| |
| function test2AfterClosing() { |
| dateElement.step = 30; |
| openPicker(dateElement, test3); |
| } |
| |
| function test3() { |
| popupWindow.focus(); |
| |
| shouldBe('entryValues().length', '2'); |
| shouldBeEqualToString('entryValues()[0]', '2012-01'); |
| shouldBeEqualToString('entryValues()[1]', '@openCalendarPicker'); |
| |
| finishJSTest(); |
| } |
| |
| </script> |
| </body> |
| </html> |