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