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 <input type=date id=date
value=
"2000-01-02">
11 <p id=
"description"></p>
12 <div id=
"console"></div>
14 description("Tests if calendar picker mouse opearations 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('date'), 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');
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');
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');
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');
51 debug('Check that mouse click sets the value.');
54 shouldBeEqualToString('document.getElementById("date").value', '2000-02-05');
56 waitUntilClosing(function() {
57 openPicker(document
.getElementById('date'), test2
);
62 debug('Check that clicking the month popup button opens the month popup.');
63 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible');
64 clickMonthPopupButton();
65 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible');
66 shouldBeEqualToString('highlightedMonthButton()', '2000-02');
67 checkYearListViewScrollOffset();
69 debug('Check that hovering over a month button highlights it.');
71 hoverOverMonthButton(2000, 9);
72 shouldBeEqualToString('highlightedMonthButton()', '2000-10');
74 debug('Check that month wheel scrolls the list in the month popup.');
76 eventSender
.mouseScrollBy(0, 1);
77 shouldBeTrue('checkYearListViewScrollOffset() > 0');
79 eventSender
.mouseScrollBy(0, -1);
80 shouldBeTrue('checkYearListViewScrollOffset() < 0');
82 debug('Check that clicking an year list cell opens it.');
83 eventSender
.mouseScrollBy(0, 10);
84 shouldBeTrue('checkYearListViewScrollOffset() > 0');
85 clickYearListCell(1999);
86 shouldBeEqualToString('highlightedMonthButton()', '1999-10');
88 debug('Check that clicking the month popup sets the month.');
90 clickMonthButton(1999, 5);
91 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible');
92 shouldBeEqualToString('currentMonth()', '1999-06');