Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1267)

Side by Side Diff: LayoutTests/fast/forms/suggestion-picker/week-suggestion-picker-mouse-operations.html

Issue 618193003: Rename page-popup helper functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 <option>2013-W14</option> 80 <option>2013-W14</option>
81 <option>2013-W15</option> 81 <option>2013-W15</option>
82 <option>2012-W00</option> <!--invalid--> 82 <option>2012-W00</option> <!--invalid-->
83 <option>2012-01-01</option> <!--invalid--> 83 <option>2012-01-01</option> <!--invalid-->
84 <option>foo</option> <!--invalid--> 84 <option>foo</option> <!--invalid-->
85 </datalist> 85 </datalist>
86 <script> 86 <script>
87 debug('Check that page popup doesn\'t exist at first.'); 87 debug('Check that page popup doesn\'t exist at first.');
88 shouldBeNull('$("mock-page-popup")'); 88 shouldBeNull('$("mock-page-popup")');
89 89
90 openPicker($('week'), test1); 90 openPickerWithMock($('week'), test1);
91 91
92 function test1() { 92 function test1() {
93 debug('Check that page popup exists.'); 93 debug('Check that page popup exists.');
94 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]'); 94 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]');
95 95
96 debug('Check that hovering over an entry highlights it.'); 96 debug('Check that hovering over an entry highlights it.');
97 hoverOverElement(popupWindow.document.querySelector('.suggestion-list-entry: nth-child(2)')); 97 hoverOverElement(popupWindow.document.querySelector('.suggestion-list-entry: nth-child(2)'));
98 shouldBeEqualToString('highlightedEntry()', '2012-W02'); 98 shouldBeEqualToString('highlightedEntry()', '2012-W02');
99 99
100 debug('Check that moving the mouse outside the popup de-highlights entries.' ); 100 debug('Check that moving the mouse outside the popup de-highlights entries.' );
101 hoverOverElement(document.getElementById('description')); 101 hoverOverElement(document.getElementById('description'));
102 shouldBeNull('highlightedEntry()'); 102 shouldBeNull('highlightedEntry()');
103 103
104 debug('Check that mouse click closes the popup and sets the value.'); 104 debug('Check that mouse click closes the popup and sets the value.');
105 clickElement(popupWindow.document.querySelector('.suggestion-list-entry:nth- child(3)')); 105 clickElement(popupWindow.document.querySelector('.suggestion-list-entry:nth- child(3)'));
106 waitUntilClosing(test1AfterClosing); 106 waitUntilClosing(test1AfterClosing);
107 } 107 }
108 108
109 function test1AfterClosing() { 109 function test1AfterClosing() {
110 shouldBeNull('$("mock-page-popup")'); 110 shouldBeNull('$("mock-page-popup")');
111 shouldBeEqualToString('document.getElementById("week").value', '2012-W03'); 111 shouldBeEqualToString('document.getElementById("week").value', '2012-W03');
112 112
113 openPicker($('week'), test2); 113 openPickerWithMock($('week'), test2);
114 } 114 }
115 115
116 var scrollTopBeforeWheelEvent = 0; 116 var scrollTopBeforeWheelEvent = 0;
117 var scrollTopAfterWheelEvent = 0; 117 var scrollTopAfterWheelEvent = 0;
118 118
119 function test2() { 119 function test2() {
120 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0]; 120 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0];
121 121
122 debug('Check that you can scroll using the mouse wheel.'); 122 debug('Check that you can scroll using the mouse wheel.');
123 123
124 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 124 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
125 dispatchWheelEvent(suggestionList, 0, -100); 125 dispatchWheelEvent(suggestionList, 0, -100);
126 scrollTopAfterWheelEvent = suggestionList.scrollTop; 126 scrollTopAfterWheelEvent = suggestionList.scrollTop;
127 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 127 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
128 128
129 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 129 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
130 dispatchWheelEvent(suggestionList, 0, 100); 130 dispatchWheelEvent(suggestionList, 0, 100);
131 scrollTopAfterWheelEvent = suggestionList.scrollTop; 131 scrollTopAfterWheelEvent = suggestionList.scrollTop;
132 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); 132 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent');
133 133
134 popupWindow.focus(); 134 popupWindow.focus();
135 eventSender.keyDown('escape'); 135 eventSender.keyDown('escape');
136 waitUntilClosing(test2AfterClosing); 136 waitUntilClosing(test2AfterClosing);
137 } 137 }
138 138
139 function test2AfterClosing() { 139 function test2AfterClosing() {
140 shouldBeNull('$("mock-page-popup")'); 140 shouldBeNull('$("mock-page-popup")');
141 141
142 openPicker($('week'), test3); 142 openPickerWithMock($('week'), test3);
143 } 143 }
144 144
145 function test3() { 145 function test3() {
146 debug('Check that you can scroll using the scroll bar.'); 146 debug('Check that you can scroll using the scroll bar.');
147 147
148 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0]; 148 var suggestionList = popupWindow.document.getElementsByClassName('suggestion -list')[0];
149 var suggestionListOffset = cumulativeOffset(suggestionList); 149 var suggestionListOffset = cumulativeOffset(suggestionList);
150 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; 150 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2;
151 151
152 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 152 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
153 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels 153 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels
154 eventSender.mouseDown(); 154 eventSender.mouseDown();
155 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); 155 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight);
156 eventSender.mouseUp(); 156 eventSender.mouseUp();
157 scrollTopAfterWheelEvent = suggestionList.scrollTop; 157 scrollTopAfterWheelEvent = suggestionList.scrollTop;
158 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 158 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
159 159
160 finishJSTest(); 160 finishJSTest();
161 } 161 }
162 162
163 </script> 163 </script>
164 </body> 164 </body>
165 </html> 165 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698