Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / forms / calendar-picker / week-picker-touch-operations.html
1 <!DOCTYPE html>
2 <html>
3 <head>
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>
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 calendar 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 openPickerWithMock(document.getElementById('week'), test);
20
21 var position;
22 eventSender.clearTouchPoints();
23
24 function test() {
25     debug('Open the month popup.');
26     shouldBeFalse('popupWindow.global.picker.monthPopupView.isVisible');
27     clickMonthPopupButton();
28     shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible');
29
30     debug('Check that touch swiping scrolls the list in the month popup.');
31
32     checkYearListViewScrollOffset();
33
34     popupWindow.global.picker.monthPopupView.yearListView.element.addEventListener('touchend', testAfterSwipingDown, false);
35
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();
44 }
45
46 function testAfterSwipingDown() {
47     shouldBeTrue('checkYearListViewScrollOffset() > 0');
48     popupWindow.global.picker.monthPopupView.yearListView.element.removeEventListener('touchend', testAfterSwipingDown, false);
49     setTimeout(testSwipingUp, 0);
50 }
51
52 function testSwipingUp() {
53     checkYearListViewScrollOffset();
54     popupWindow.global.picker.monthPopupView.yearListView.element.addEventListener('touchend', testAfterSwipingUp, false);
55
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();
63 }
64
65 function testAfterSwipingUp() {
66     shouldBeTrue('checkYearListViewScrollOffset() < 0');
67     popupWindow.global.picker.monthPopupView.yearListView.element.removeEventListener('touchend', testAfterSwipingUp, false);
68     finishJSTest();
69 }
70 </script>
71 </body>
72 </html>