| 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/common.js"></script> | |
| 6 <script src="../../../../../fast/forms/resources/picker-common.js"></script> | |
| 7 <script src="resources/calendar-picker-common.js"></script> | |
| 8 </head> | |
| 9 <body> | |
| 10 <p id="description"></p> | |
| 11 <div id="console"></div> | |
| 12 <input type=date id=date value="2000-01-02"> | |
| 13 <script> | |
| 14 description("Tests if calendar picker mouse opearations work as expected."); | |
| 15 | |
| 16 debug('Check that page popup doesn\'t exist at first.'); | |
| 17 shouldBeNull('document.getElementById("mock-page-popup")'); | |
| 18 | |
| 19 openPicker(document.getElementById('date'), test); | |
| 20 | |
| 21 function test() { | |
| 22 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 23 shouldBeEqualToString('selectedValue()', '2000-01-02'); | |
| 24 shouldBeEqualToString('selectedDayCells()', '2000-01-02'); | |
| 25 shouldBeEqualToString('highlightedValue()', '2000-01-02'); | |
| 26 shouldBeEqualToString('highlightedDayCells()', '2000-01-02'); | |
| 27 | |
| 28 debug('Check that hovering over an entry highlights it.'); | |
| 29 hoverOverDayCellAt(5, 0); | |
| 30 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 31 shouldBeEqualToString('selectedValue()', '2000-01-02'); | |
| 32 shouldBeEqualToString('selectedDayCells()', '2000-01-02'); | |
| 33 shouldBeEqualToString('highlightedValue()', '1999-12-31'); | |
| 34 shouldBeEqualToString('highlightedDayCells()', '1999-12-31'); | |
| 35 | |
| 36 hoverOverDayCellAt(2, 1); | |
| 37 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 38 shouldBeEqualToString('selectedValue()', '2000-01-02'); | |
| 39 shouldBeEqualToString('selectedDayCells()', '2000-01-02'); | |
| 40 shouldBeEqualToString('highlightedValue()', '2000-01-04'); | |
| 41 shouldBeEqualToString('highlightedDayCells()', '2000-01-04'); | |
| 42 | |
| 43 debug('Check that navigating between months maintains highlighted position.'
); | |
| 44 eventSender.keyDown('m'); | |
| 45 shouldBeEqualToString('currentMonth()', '2000-02'); | |
| 46 shouldBeEqualToString('selectedValue()', '2000-01-02'); | |
| 47 shouldBeEqualToString('selectedDayCells()', ''); | |
| 48 shouldBeEqualToString('highlightedValue()', '2000-02-08'); | |
| 49 shouldBeEqualToString('highlightedDayCells()', '2000-02-08'); | |
| 50 | |
| 51 debug('Check that mouse click sets the value.'); | |
| 52 clickDayCellAt(6, 0); | |
| 53 shouldBeEqualToString('currentMonth()', '2000-02'); | |
| 54 shouldBeEqualToString('selectedValue()', '2000-02-05'); | |
| 55 shouldBeEqualToString('selectedDayCells()', '2000-02-05'); | |
| 56 shouldBeEqualToString('highlightedValue()', '2000-02-05'); | |
| 57 shouldBeEqualToString('highlightedDayCells()', '2000-02-05'); | |
| 58 shouldBeEqualToString('document.getElementById("date").value', '2000-02-05')
; | |
| 59 | |
| 60 debug('Check that clicking the month popup button opens the month popup.'); | |
| 61 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 62 clickMonthPopupButton(); | |
| 63 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 64 shouldBeEqualToString('highlightedMonthButton()', '2000-02'); | |
| 65 checkYearListViewScrollOffset(); | |
| 66 | |
| 67 debug('Check that hovering over a month button highlights it.'); | |
| 68 | |
| 69 hoverOverMonthButton(2000, 9); | |
| 70 shouldBeEqualToString('highlightedMonthButton()', '2000-10'); | |
| 71 | |
| 72 debug('Check that month wheel scrolls the list in the month popup.'); | |
| 73 | |
| 74 eventSender.mouseScrollBy(0, 1); | |
| 75 shouldBeTrue('checkYearListViewScrollOffset() > 0'); | |
| 76 | |
| 77 eventSender.mouseScrollBy(0, -1); | |
| 78 shouldBeTrue('checkYearListViewScrollOffset() < 0'); | |
| 79 | |
| 80 debug('Check that clicking an year list cell opens it.'); | |
| 81 eventSender.mouseScrollBy(0, 10); | |
| 82 shouldBeTrue('checkYearListViewScrollOffset() > 0'); | |
| 83 clickYearListCell(1999); | |
| 84 shouldBeEqualToString('highlightedMonthButton()', '1999-10'); | |
| 85 | |
| 86 debug('Check that clicking the month popup sets the month.'); | |
| 87 | |
| 88 clickMonthButton(1999, 5); | |
| 89 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 90 shouldBeEqualToString('currentMonth()', '1999-06'); | |
| 91 | |
| 92 finishJSTest(); | |
| 93 } | |
| 94 </script> | |
| 95 <script src="../../../../../fast/js/resources/js-test-post.js"></script> | |
| 96 </body> | |
| 97 </html> | |
| OLD | NEW |