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=date id=date
value=
"2000-01-02">
14 description("Tests if calendar 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('date'), test
);
22 eventSender
.clearTouchPoints();
25 debug('Open the month popup.');
26 shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible');
27 clickMonthPopupButton();
28 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible');
30 debug('Check that touch swiping scrolls the list in the month popup.');
32 checkYearListViewScrollOffset();
34 popupWindow
.global
.picker
.monthPopupView
.yearListView
.element
.addEventListener('touchend', testAfterSwipingDown
, false);
36 position
= skipAnimationAndGetPositionOfMonthButton(2000, 0);
37 eventSender
.addTouchPoint(position
.x
, position
.y
);
38 eventSender
.touchStart();
39 position
= skipAnimationAndGetPositionOfMonthButton(2000, 11);
40 eventSender
.updateTouchPoint(0, position
.x
, position
.y
);
41 eventSender
.touchMove();
42 eventSender
.releaseTouchPoint(0);
43 eventSender
.touchEnd();
46 function testAfterSwipingDown() {
47 shouldBeTrue('checkYearListViewScrollOffset() > 0');
48 popupWindow
.global
.picker
.monthPopupView
.yearListView
.element
.removeEventListener('touchend', testAfterSwipingDown
, false);
49 setTimeout(testSwipingUp
, 0);
52 function testSwipingUp() {
53 checkYearListViewScrollOffset();
54 popupWindow
.global
.picker
.monthPopupView
.yearListView
.element
.addEventListener('touchend', testAfterSwipingUp
, false);
56 eventSender
.addTouchPoint(position
.x
, position
.y
);
57 eventSender
.touchStart();
58 position
= skipAnimationAndGetPositionOfMonthPopupButton();
59 eventSender
.updateTouchPoint(0, position
.x
, position
.y
);
60 eventSender
.touchMove();
61 eventSender
.releaseTouchPoint(0);
62 eventSender
.touchEnd();
65 function testAfterSwipingUp() {
66 shouldBeTrue('checkYearListViewScrollOffset() < 0');
67 popupWindow
.global
.picker
.monthPopupView
.yearListView
.element
.removeEventListener('touchend', testAfterSwipingUp
, false);