| 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=week id=week value="2000-W01"> | |
| 13 <script> | |
| 14 description("Tests if week picker mouse operations 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('week'), test); | |
| 20 | |
| 21 function test() { | |
| 22 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 23 shouldBeEqualToString('selectedValue()', '2000-W01'); | |
| 24 shouldBeEqualToString('selectedDayCells()', '2000-01-03,2000-01-04,2000-01-0
5,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); | |
| 25 shouldBeEqualToString('highlightedValue()', '2000-W01'); | |
| 26 shouldBeEqualToString('highlightedDayCells()', '2000-01-03,2000-01-04,2000-0
1-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); | |
| 27 | |
| 28 debug('Check that hovering over an entry highlights it.'); | |
| 29 hoverOverDayCellAt(0, 0); | |
| 30 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 31 shouldBeEqualToString('selectedValue()', '2000-W01'); | |
| 32 shouldBeEqualToString('selectedDayCells()', '2000-01-03,2000-01-04,2000-01-0
5,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); | |
| 33 shouldBeEqualToString('highlightedValue()', '1999-W51'); | |
| 34 shouldBeEqualToString('highlightedDayCells()', '1999-12-26'); | |
| 35 | |
| 36 hoverOverDayCellAt(6, 0); | |
| 37 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 38 shouldBeEqualToString('selectedValue()', '2000-W01'); | |
| 39 shouldBeEqualToString('selectedDayCells()', '2000-01-03,2000-01-04,2000-01-0
5,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); | |
| 40 shouldBeEqualToString('highlightedValue()', '1999-W52'); | |
| 41 shouldBeEqualToString('highlightedDayCells()', '1999-12-27,1999-12-28,1999-1
2-29,1999-12-30,1999-12-31,2000-01-01,2000-01-02'); | |
| 42 | |
| 43 hoverOverDayCellAt(2, 1); | |
| 44 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 45 shouldBeEqualToString('selectedValue()', '2000-W01'); | |
| 46 shouldBeEqualToString('selectedDayCells()', '2000-01-03,2000-01-04,2000-01-0
5,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); | |
| 47 shouldBeEqualToString('highlightedValue()', '2000-W01'); | |
| 48 shouldBeEqualToString('highlightedDayCells()', '2000-01-03,2000-01-04,2000-0
1-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); | |
| 49 | |
| 50 hoverOverDayCellAt(6, 5); | |
| 51 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 52 shouldBeEqualToString('selectedValue()', '2000-W01'); | |
| 53 shouldBeEqualToString('selectedDayCells()', '2000-01-03,2000-01-04,2000-01-0
5,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); | |
| 54 shouldBeEqualToString('highlightedValue()', '2000-W05'); | |
| 55 shouldBeEqualToString('highlightedDayCells()', '2000-01-31,2000-02-01,2000-0
2-02,2000-02-03,2000-02-04,2000-02-05'); | |
| 56 | |
| 57 debug('Check that mouse click sets the value.'); | |
| 58 clickDayCellAt(6, 0); | |
| 59 shouldBeEqualToString('currentMonth()', '2000-01'); | |
| 60 shouldBeEqualToString('selectedValue()', '1999-W52'); | |
| 61 shouldBeEqualToString('selectedDayCells()', '1999-12-27,1999-12-28,1999-12-2
9,1999-12-30,1999-12-31,2000-01-01,2000-01-02'); | |
| 62 shouldBeEqualToString('highlightedValue()', '1999-W52'); | |
| 63 shouldBeEqualToString('highlightedDayCells()', '1999-12-27,1999-12-28,1999-1
2-29,1999-12-30,1999-12-31,2000-01-01,2000-01-02'); | |
| 64 shouldBeEqualToString('document.getElementById("week").value', '1999-W52'); | |
| 65 | |
| 66 debug('Check that clicking the month popup button opens the month popup.'); | |
| 67 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 68 clickMonthPopupButton(); | |
| 69 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 70 shouldBeEqualToString('highlightedMonthButton()', '2000-01'); | |
| 71 | |
| 72 debug('Check that hovering over a month button highlights it.'); | |
| 73 | |
| 74 hoverOverMonthButton(2000, 9); | |
| 75 shouldBeEqualToString('highlightedMonthButton()', '2000-10'); | |
| 76 | |
| 77 debug('Check that month wheel scrolls the list in the month popup.'); | |
| 78 | |
| 79 checkYearListViewScrollOffset(); | |
| 80 eventSender.mouseScrollBy(0, 120); | |
| 81 shouldBeTrue('checkYearListViewScrollOffset() > 0'); | |
| 82 | |
| 83 checkYearListViewScrollOffset(); | |
| 84 eventSender.mouseScrollBy(0, -120); | |
| 85 shouldBeTrue('checkYearListViewScrollOffset() < 0'); | |
| 86 | |
| 87 debug('Check that clicking the month popup sets the month.'); | |
| 88 | |
| 89 clickMonthButton(2000, 5); | |
| 90 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 91 shouldBeEqualToString('currentMonth()', '2000-06'); | |
| 92 | |
| 93 debug('Check that clicking the month popup button opens the month popup.'); | |
| 94 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 95 clickMonthPopupButton(); | |
| 96 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 97 shouldBeEqualToString('highlightedMonthButton()', '2000-06'); | |
| 98 checkYearListViewScrollOffset(); | |
| 99 | |
| 100 debug('Check that hovering over a month button highlights it.'); | |
| 101 | |
| 102 hoverOverMonthButton(2000, 9); | |
| 103 shouldBeEqualToString('highlightedMonthButton()', '2000-10'); | |
| 104 | |
| 105 debug('Check that month wheel scrolls the list in the month popup.'); | |
| 106 | |
| 107 eventSender.mouseScrollBy(0, 1); | |
| 108 shouldBeTrue('checkYearListViewScrollOffset() > 0'); | |
| 109 | |
| 110 eventSender.mouseScrollBy(0, -1); | |
| 111 shouldBeTrue('checkYearListViewScrollOffset() < 0'); | |
| 112 | |
| 113 debug('Check that clicking an year list cell opens it.'); | |
| 114 eventSender.mouseScrollBy(0, 10); | |
| 115 shouldBeTrue('checkYearListViewScrollOffset() > 0'); | |
| 116 clickYearListCell(1999); | |
| 117 shouldBeEqualToString('highlightedMonthButton()', '1999-10'); | |
| 118 | |
| 119 debug('Check that clicking the month popup sets the month.'); | |
| 120 | |
| 121 clickMonthButton(1999, 5); | |
| 122 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible'); | |
| 123 shouldBeEqualToString('currentMonth()', '1999-06'); | |
| 124 | |
| 125 finishJSTest(); | |
| 126 } | |
| 127 </script> | |
| 128 <script src="../../../../../fast/js/resources/js-test-post.js"></script> | |
| 129 </body> | |
| 130 </html> | |
| OLD | NEW |