4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../../forms/resources/common.js"></script>
6 <script src=
"../../forms/resources/picker-common.js"></script>
7 <script src=
"resources/calendar-picker-common.js"></script>
10 <p id=
"description"></p>
11 <div id=
"console"></div>
12 <input type=month id=month
value=
"2000-01">
14 description("Tests if month picker mouse operations work as expected.");
16 debug('Check that page popup doesn\'t exist at first.');
17 shouldBeNull('document.getElementById("mock-page-popup")');
19 openPicker(document
.getElementById('month'), test
);
22 shouldBeEqualToString('currentMonth()', '2000-01');
23 shouldBeEqualToString('selectedValue()', '2000-01');
24 shouldBeEqualToString('selectedDayCells()', '2000-01-01,2000-01-02,2000-01-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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-01-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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');
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-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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-12-28,1999-12-29,1999-12-30,1999-12-31');
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-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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-02-03,2000-02-04,2000-02-05');
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-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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-01-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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');
50 debug('Check that mouse click sets the value.');
52 shouldBeEqualToString('currentMonth()', '2000-01');
53 shouldBeEqualToString('selectedValue()', '2000-01');
54 shouldBeEqualToString('selectedDayCells()', '2000-01-01,2000-01-02,2000-01-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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-01-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2000-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');
57 shouldBeEqualToString('document.getElementById("month").value', '2000-01');
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');
65 debug('Check that hovering over a month button highlights it.');
67 hoverOverMonthButton(2000, 9);
68 shouldBeEqualToString('highlightedMonthButton()', '2000-10');
70 debug('Check that month wheel scrolls the list in the month popup.');
72 checkYearListViewScrollOffset();
73 eventSender
.mouseScrollBy(0, 120);
74 shouldBeTrue('checkYearListViewScrollOffset() > 0');
76 checkYearListViewScrollOffset();
77 eventSender
.mouseScrollBy(0, -120);
78 shouldBeTrue('checkYearListViewScrollOffset() < 0');
80 debug('Check that clicking the month popup sets the month.');
82 clickMonthButton(2000, 5);
83 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible');
84 shouldBeEqualToString('currentMonth()', '2000-06');
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();
93 debug('Check that hovering over a month button highlights it.');
95 hoverOverMonthButton(2000, 9);
96 shouldBeEqualToString('highlightedMonthButton()', '2000-10');
98 debug('Check that month wheel scrolls the list in the month popup.');
100 eventSender
.mouseScrollBy(0, 1);
101 shouldBeTrue('checkYearListViewScrollOffset() > 0');
103 eventSender
.mouseScrollBy(0, -1);
104 shouldBeTrue('checkYearListViewScrollOffset() < 0');
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');
112 debug('Check that clicking the month popup sets the month.');
114 clickMonthButton(1999, 5);
115 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible');
116 shouldBeEqualToString('currentMonth()', '1999-06');