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

Side by Side Diff: LayoutTests/fast/forms/calendar-picker/week-picker-key-operations.html

Issue 484353004: Test tidying: use "escape" and "backspace" with eventSender.keyDown() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More quoting consistency wibbles Created 6 years, 4 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
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/picker-common.js"></script> 5 <script src="../../forms/resources/picker-common.js"></script>
6 <script src="resources/calendar-picker-common.js"></script> 6 <script src="resources/calendar-picker-common.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <p id="description"></p> 9 <p id="description"></p>
10 <div id="console"></div> 10 <div id="console"></div>
11 <input type=week id=week value="2000-W01"> 11 <input type=week id=week value="2000-W01">
12 <script> 12 <script>
13 description("Tests if month picker key bindings work as expected."); 13 description("Tests if month picker key bindings work as expected.");
14 14
15 debug('Check that page popup doesn\'t exist at first.'); 15 debug('Check that page popup doesn\'t exist at first.');
16 shouldBeNull('document.getElementById("mock-page-popup")'); 16 shouldBeNull('document.getElementById("mock-page-popup")');
17 17
18 openPicker(document.getElementById('week'), test1); 18 openPicker(document.getElementById('week'), test1);
19 19
20 function test1() { 20 function test1() {
21 debug('Check that page popup exists.'); 21 debug('Check that page popup exists.');
22 shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupCo ntroller]"'); 22 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]');
23 23
24 shouldBeFalse('isCalendarTableScrollingWithAnimation()'); 24 shouldBeFalse('isCalendarTableScrollingWithAnimation()');
25 shouldBeEqualToString('currentMonth()', '2000-01'); 25 shouldBeEqualToString('currentMonth()', '2000-01');
26 shouldBeEqualToString('selectedValue()', '2000-W01'); 26 shouldBeEqualToString('selectedValue()', '2000-W01');
27 shouldBeEqualToString('selectedDayCells()', '2000-01-03,2000-01-04,2000-01-0 5,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); 27 shouldBeEqualToString('selectedDayCells()', '2000-01-03,2000-01-04,2000-01-0 5,2000-01-06,2000-01-07,2000-01-08,2000-01-09');
28 shouldBeEqualToString('highlightedValue()', '2000-W01'); 28 shouldBeEqualToString('highlightedValue()', '2000-W01');
29 shouldBeEqualToString('highlightedDayCells()', '2000-01-03,2000-01-04,2000-0 1-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09'); 29 shouldBeEqualToString('highlightedDayCells()', '2000-01-03,2000-01-04,2000-0 1-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09');
30 30
31 debug('Check that arrow keys work properly.'); 31 debug('Check that arrow keys work properly.');
32 32
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 shouldBeEqualToString('highlightedDayCells()', '2000-01-10,2000-01-11,2000-0 1-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16'); 159 shouldBeEqualToString('highlightedDayCells()', '2000-01-10,2000-01-11,2000-0 1-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16');
160 160
161 debug("press enter"); 161 debug("press enter");
162 setNoCloseOnCommit(); 162 setNoCloseOnCommit();
163 eventSender.keyDown('\n'); 163 eventSender.keyDown('\n');
164 shouldBeEqualToString('currentMonth()', '2000-01'); 164 shouldBeEqualToString('currentMonth()', '2000-01');
165 shouldBeEqualToString('selectedValue()', '2000-W02'); 165 shouldBeEqualToString('selectedValue()', '2000-W02');
166 shouldBeEqualToString('selectedDayCells()', '2000-01-10,2000-01-11,2000-01-1 2,2000-01-13,2000-01-14,2000-01-15,2000-01-16'); 166 shouldBeEqualToString('selectedDayCells()', '2000-01-10,2000-01-11,2000-01-1 2,2000-01-13,2000-01-14,2000-01-15,2000-01-16');
167 shouldBeEqualToString('highlightedValue()', '2000-W02'); 167 shouldBeEqualToString('highlightedValue()', '2000-W02');
168 shouldBeEqualToString('highlightedDayCells()', '2000-01-10,2000-01-11,2000-0 1-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16'); 168 shouldBeEqualToString('highlightedDayCells()', '2000-01-10,2000-01-11,2000-0 1-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16');
169 shouldBe('document.getElementById("week").value', '"2000-W02"'); 169 shouldBeEqualToString('document.getElementById("week").value', '2000-W02');
170 170
171 debug('Check if tabbing works.'); 171 debug('Check if tabbing works.');
172 shouldBe('focusedElement()', '".list-view calendar-table-view"'); 172 shouldBeEqualToString('focusedElement()', '.list-view calendar-table-view');
173 eventSender.keyDown('\t', ['shiftKey']); 173 eventSender.keyDown('\t', ['shiftKey']);
174 shouldBe('focusedElement()', '".calendar-navigation-button"'); 174 shouldBeEqualToString('focusedElement()', '.calendar-navigation-button');
175 eventSender.keyDown('\t', ['shiftKey']); 175 eventSender.keyDown('\t', ['shiftKey']);
176 shouldBe('focusedElement()', '".calendar-navigation-button today-button"'); 176 shouldBeEqualToString('focusedElement()', '.calendar-navigation-button today -button');
177 eventSender.keyDown('\t', ['shiftKey']); 177 eventSender.keyDown('\t', ['shiftKey']);
178 shouldBe('focusedElement()', '".calendar-navigation-button"'); 178 shouldBeEqualToString('focusedElement()', '.calendar-navigation-button');
179 eventSender.keyDown('\t', ['shiftKey']); 179 eventSender.keyDown('\t', ['shiftKey']);
180 shouldBe('focusedElement()', '".month-popup-button"'); 180 shouldBeEqualToString('focusedElement()', '.month-popup-button');
181 181
182 debug('open the month popup'); 182 debug('open the month popup');
183 eventSender.keyDown('\n'); 183 eventSender.keyDown('\n');
184 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible'); 184 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible');
185 shouldBeEqualToString('highlightedMonthButton()', '2000-01'); 185 shouldBeEqualToString('highlightedMonthButton()', '2000-01');
186 186
187 debug("press down"); 187 debug("press down");
188 eventSender.keyDown('downArrow'); 188 eventSender.keyDown('downArrow');
189 shouldBeEqualToString('highlightedMonthButton()', '2000-05'); 189 shouldBeEqualToString('highlightedMonthButton()', '2000-05');
190 190
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 shouldBeEqualToString('highlightedDayCells()', ''); 234 shouldBeEqualToString('highlightedDayCells()', '');
235 235
236 debug("focus calendar table"); 236 debug("focus calendar table");
237 popupWindow.global.picker.calendarTableView.element.focus(); 237 popupWindow.global.picker.calendarTableView.element.focus();
238 238
239 // Test twice in case midnight. 239 // Test twice in case midnight.
240 debug("press t"); 240 debug("press t");
241 shouldBeTrue('testToday() || testToday()'); 241 shouldBeTrue('testToday() || testToday()');
242 242
243 debug("press esc"); 243 debug("press esc");
244 eventSender.keyDown('\x1B'); 244 eventSender.keyDown('escape');
245 waitUntilClosing(test2AfterClosing); 245 waitUntilClosing(test2AfterClosing);
246 } 246 }
247 247
248 function test2AfterClosing() { 248 function test2AfterClosing() {
249 shouldBeNull('document.getElementById("mock-page-popup")'); 249 shouldBeNull('document.getElementById("mock-page-popup")');
250 250
251 finishJSTest(); 251 finishJSTest();
252 } 252 }
253 253
254 function testToday() { 254 function testToday() {
(...skipping 10 matching lines...) Expand all
265 return null; 265 return null;
266 var identifier = "." + element.className; 266 var identifier = "." + element.className;
267 if (element.value) 267 if (element.value)
268 identifier += "[value=" + element.value + "]"; 268 identifier += "[value=" + element.value + "]";
269 return identifier; 269 return identifier;
270 } 270 }
271 271
272 </script> 272 </script>
273 </body> 273 </body>
274 </html> 274 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698