| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../js/resources/js-test-pre.js"></script> |
| <script src="../resources/common.js"></script> |
| <script src="calendar-picker-common.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <input type=date id=date value="2000-01-02"> |
| <script> |
| description("Tests if calendar picker key bindings work as expected."); |
| |
| debug('Check that page popup doesn\'t exist at first.'); |
| shouldBeNull('document.getElementById("mock-page-popup")'); |
| |
| openPicker(document.getElementById('date')); |
| |
| popupWindow.addEventListener("resize", test, false); |
| |
| function test() { |
| popupWindow.removeEventListener("resize", test, false); |
| |
| shouldBe('selectedDate()', '"2000-01-02"'); |
| shouldBe('currentMonth()', '"2000-0"'); |
| |
| debug('Check that hovering over an entry highlights it.'); |
| hoverOverElement(popupWindow.document.getElementsByClassName("day")[5]); |
| shouldBe('selectedDate()', '"1999-12-31"'); |
| shouldBe('currentMonth()', '"2000-0"'); |
| |
| hoverOverElement(popupWindow.document.getElementsByClassName("day")[9]); |
| shouldBe('selectedDate()', '"2000-01-04"'); |
| shouldBe('currentMonth()', '"2000-0"'); |
| |
| debug('Check that navigating between months maintains selection position.'); |
| eventSender.keyDown('m'); |
| shouldBe('selectedDate()', '"2000-02-08"'); |
| shouldBe('currentMonth()', '"2000-1"'); |
| |
| debug('Check that moving the mouse outside the popup de-highlights entries.'); |
| hoverOverElement(document.getElementById('description')); |
| shouldBeUndefined('selectedDate()'); |
| |
| debug('Check that mouse click closes the popup and sets the value.'); |
| clickElement(popupWindow.document.getElementsByClassName("day")[6]); |
| shouldBeNull('document.getElementById("mock-page-popup")'); |
| shouldBe('document.getElementById("date").value', '"2000-02-05"'); |
| |
| finishJSTest(); |
| } |
| </script> |
| <script src="../../js/resources/js-test-post.js"></script> |
| </body> |
| |