OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script src="../../forms/resources/common.js"></script> | 5 <script src="../../forms/resources/common.js"></script> |
6 <script src="../../forms/resources/common-wheel-event.js"></script> | 6 <script src="../../forms/resources/common-wheel-event.js"></script> |
7 <script src="../../forms/resources/picker-common.js"></script> | 7 <script src="../../forms/resources/picker-common.js"></script> |
8 <script src="resources/suggestion-picker-common.js"></script> | 8 <script src="resources/suggestion-picker-common.js"></script> |
9 </head> | 9 </head> |
10 <body style="background-color: #bbbbbb;"> | 10 <body style="background-color: #bbbbbb;"> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 function test1AfterClosing() { | 66 function test1AfterClosing() { |
67 shouldBeNull('document.getElementById("mock-page-popup")'); | 67 shouldBeNull('document.getElementById("mock-page-popup")'); |
68 shouldBeEqualToString('document.getElementById("time").value', '01:03'); | 68 shouldBeEqualToString('document.getElementById("time").value', '01:03'); |
69 | 69 |
70 openPicker($('time'), test2); | 70 openPicker($('time'), test2); |
71 } | 71 } |
72 | 72 |
73 var scrollTopBeforeWheelEvent = 0; | 73 var scrollTopBeforeWheelEvent = 0; |
74 var scrollTopAfterWheelEvent = 0; | 74 var scrollTopAfterWheelEvent = 0; |
| 75 var suggestionList; |
75 | 76 |
76 function test2() { | 77 function test2() { |
77 var suggestionList = popupWindow.document.getElementsByClassName("suggestion
-list")[0]; | 78 suggestionList = popupWindow.document.getElementsByClassName("suggestion-lis
t")[0]; |
78 | 79 |
79 debug('Check that you can scroll using the mouse wheel.'); | 80 debug('Check that you can scroll using the mouse wheel.'); |
80 | 81 |
81 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 82 function finishTest() { |
82 dispatchWheelEvent(suggestionList, 0, -100); | 83 popupWindow.focus(); |
83 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 84 eventSender.keyDown('escape'); |
84 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 85 waitUntilClosing(test2AfterClosing); |
| 86 } |
85 | 87 |
86 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 88 function scrollUp() { |
87 dispatchWheelEvent(suggestionList, 0, 100); | 89 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
88 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 90 dispatchWheelEvent(suggestionList, 0, 100); |
89 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); | 91 shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop'
, 'true', finishTest) |
| 92 } |
90 | 93 |
91 popupWindow.focus(); | 94 function scrollDown() { |
92 eventSender.keyDown('escape'); | 95 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
93 waitUntilClosing(test2AfterClosing); | 96 dispatchWheelEvent(suggestionList, 0, -100); |
| 97 shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop'
, 'true', scrollUp); |
| 98 } |
| 99 |
| 100 scrollDown(); |
94 } | 101 } |
95 | 102 |
96 function test2AfterClosing() { | 103 function test2AfterClosing() { |
97 shouldBeNull('$("mock-page-popup")'); | 104 shouldBeNull('$("mock-page-popup")'); |
98 | 105 |
99 openPicker($('time'), test3); | 106 openPicker($('time'), test3); |
100 } | 107 } |
101 | 108 |
102 function test3() { | 109 function test3() { |
103 debug('Check that you can scroll using the scroll bar.'); | 110 debug('Check that you can scroll using the scroll bar.'); |
104 | 111 |
105 var suggestionList = popupWindow.document.getElementsByClassName("suggestion
-list")[0]; | 112 var suggestionList = popupWindow.document.getElementsByClassName("suggestion
-list")[0]; |
106 var suggestionListOffset = cumulativeOffset(suggestionList); | 113 var suggestionListOffset = cumulativeOffset(suggestionList); |
107 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth
- popupWindow.getScrollbarWidth() / 2; | 114 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth
- popupWindow.getScrollbarWidth() / 2; |
108 | 115 |
109 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 116 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
110 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); //
20 is the height of the up arrow button plus a few pixels | 117 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); //
20 is the height of the up arrow button plus a few pixels |
111 eventSender.mouseDown(); | 118 eventSender.mouseDown(); |
112 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti
onList.offsetHeight); | 119 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti
onList.offsetHeight); |
113 eventSender.mouseUp(); | 120 eventSender.mouseUp(); |
114 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 121 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
115 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 122 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); |
116 | 123 |
117 finishJSTest(); | 124 finishJSTest(); |
118 } | 125 } |
119 | 126 |
120 </script> | 127 </script> |
121 </body> | 128 </body> |
122 </html> | 129 </html> |
OLD | NEW |