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

Side by Side Diff: LayoutTests/fast/forms/calendar-picker/month-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=month id=month value="2000-01"> 11 <input type=month id=month value="2000-01">
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('month'), test1); 18 openPicker(document.getElementById('month'), 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-01'); 26 shouldBeEqualToString('selectedValue()', '2000-01');
27 shouldBeEqualToString('selectedDayCells()', '2000-01-01,2000-01-02,2000-01-0 3,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2 000-01-11,2000-01-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16,2000-01-17,2000 -01-18,2000-01-19,2000-01-20,2000-01-21,2000-01-22,2000-01-23,2000-01-24,2000-01 -25,2000-01-26,2000-01-27,2000-01-28,2000-01-29,2000-01-30,2000-01-31'); 27 shouldBeEqualToString('selectedDayCells()', '2000-01-01,2000-01-02,2000-01-0 3,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-10,2 000-01-11,2000-01-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16,2000-01-17,2000 -01-18,2000-01-19,2000-01-20,2000-01-21,2000-01-22,2000-01-23,2000-01-24,2000-01 -25,2000-01-26,2000-01-27,2000-01-28,2000-01-29,2000-01-30,2000-01-31');
28 shouldBeEqualToString('highlightedValue()', '2000-01'); 28 shouldBeEqualToString('highlightedValue()', '2000-01');
29 shouldBeEqualToString('highlightedDayCells()', '2000-01-01,2000-01-02,2000-0 1-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-1 0,2000-01-11,2000-01-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16,2000-01-17,2 000-01-18,2000-01-19,2000-01-20,2000-01-21,2000-01-22,2000-01-23,2000-01-24,2000 -01-25,2000-01-26,2000-01-27,2000-01-28,2000-01-29,2000-01-30,2000-01-31'); 29 shouldBeEqualToString('highlightedDayCells()', '2000-01-01,2000-01-02,2000-0 1-03,2000-01-04,2000-01-05,2000-01-06,2000-01-07,2000-01-08,2000-01-09,2000-01-1 0,2000-01-11,2000-01-12,2000-01-13,2000-01-14,2000-01-15,2000-01-16,2000-01-17,2 000-01-18,2000-01-19,2000-01-20,2000-01-21,2000-01-22,2000-01-23,2000-01-24,2000 -01-25,2000-01-26,2000-01-27,2000-01-28,2000-01-29,2000-01-30,2000-01-31');
30 30
31 debug('Check that arrow keys work properly.'); 31 debug('Check that arrow keys work properly.');
32 32
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 shouldBeEqualToString('highlightedDayCells()', '2000-02-01,2000-02-02,2000-0 2-03,2000-02-04,2000-02-05,2000-02-06,2000-02-07,2000-02-08,2000-02-09,2000-02-1 0,2000-02-11,2000-02-12,2000-02-13,2000-02-14,2000-02-15,2000-02-16,2000-02-17,2 000-02-18,2000-02-19,2000-02-20,2000-02-21,2000-02-22,2000-02-23,2000-02-24,2000 -02-25,2000-02-26,2000-02-27,2000-02-28,2000-02-29'); 146 shouldBeEqualToString('highlightedDayCells()', '2000-02-01,2000-02-02,2000-0 2-03,2000-02-04,2000-02-05,2000-02-06,2000-02-07,2000-02-08,2000-02-09,2000-02-1 0,2000-02-11,2000-02-12,2000-02-13,2000-02-14,2000-02-15,2000-02-16,2000-02-17,2 000-02-18,2000-02-19,2000-02-20,2000-02-21,2000-02-22,2000-02-23,2000-02-24,2000 -02-25,2000-02-26,2000-02-27,2000-02-28,2000-02-29');
147 147
148 debug("press enter"); 148 debug("press enter");
149 setNoCloseOnCommit(); 149 setNoCloseOnCommit();
150 eventSender.keyDown('\n'); 150 eventSender.keyDown('\n');
151 shouldBeEqualToString('currentMonth()', '2000-02'); 151 shouldBeEqualToString('currentMonth()', '2000-02');
152 shouldBeEqualToString('selectedValue()', '2000-02'); 152 shouldBeEqualToString('selectedValue()', '2000-02');
153 shouldBeEqualToString('selectedDayCells()', '2000-02-01,2000-02-02,2000-02-0 3,2000-02-04,2000-02-05,2000-02-06,2000-02-07,2000-02-08,2000-02-09,2000-02-10,2 000-02-11,2000-02-12,2000-02-13,2000-02-14,2000-02-15,2000-02-16,2000-02-17,2000 -02-18,2000-02-19,2000-02-20,2000-02-21,2000-02-22,2000-02-23,2000-02-24,2000-02 -25,2000-02-26,2000-02-27,2000-02-28,2000-02-29'); 153 shouldBeEqualToString('selectedDayCells()', '2000-02-01,2000-02-02,2000-02-0 3,2000-02-04,2000-02-05,2000-02-06,2000-02-07,2000-02-08,2000-02-09,2000-02-10,2 000-02-11,2000-02-12,2000-02-13,2000-02-14,2000-02-15,2000-02-16,2000-02-17,2000 -02-18,2000-02-19,2000-02-20,2000-02-21,2000-02-22,2000-02-23,2000-02-24,2000-02 -25,2000-02-26,2000-02-27,2000-02-28,2000-02-29');
154 shouldBeEqualToString('highlightedValue()', '2000-02'); 154 shouldBeEqualToString('highlightedValue()', '2000-02');
155 shouldBeEqualToString('highlightedDayCells()', '2000-02-01,2000-02-02,2000-0 2-03,2000-02-04,2000-02-05,2000-02-06,2000-02-07,2000-02-08,2000-02-09,2000-02-1 0,2000-02-11,2000-02-12,2000-02-13,2000-02-14,2000-02-15,2000-02-16,2000-02-17,2 000-02-18,2000-02-19,2000-02-20,2000-02-21,2000-02-22,2000-02-23,2000-02-24,2000 -02-25,2000-02-26,2000-02-27,2000-02-28,2000-02-29'); 155 shouldBeEqualToString('highlightedDayCells()', '2000-02-01,2000-02-02,2000-0 2-03,2000-02-04,2000-02-05,2000-02-06,2000-02-07,2000-02-08,2000-02-09,2000-02-1 0,2000-02-11,2000-02-12,2000-02-13,2000-02-14,2000-02-15,2000-02-16,2000-02-17,2 000-02-18,2000-02-19,2000-02-20,2000-02-21,2000-02-22,2000-02-23,2000-02-24,2000 -02-25,2000-02-26,2000-02-27,2000-02-28,2000-02-29');
156 shouldBe('document.getElementById("month").value', '"2000-02"'); 156 shouldBeEqualToString('document.getElementById("month").value', '2000-02');
157 157
158 debug('Check if tabbing works.'); 158 debug('Check if tabbing works.');
159 shouldBe('focusedElement()', '".list-view calendar-table-view"'); 159 shouldBeEqualToString('focusedElement()', '.list-view calendar-table-view');
160 eventSender.keyDown('\t', ['shiftKey']); 160 eventSender.keyDown('\t', ['shiftKey']);
161 shouldBe('focusedElement()', '".calendar-navigation-button"'); 161 shouldBeEqualToString('focusedElement()', '.calendar-navigation-button');
162 eventSender.keyDown('\t', ['shiftKey']); 162 eventSender.keyDown('\t', ['shiftKey']);
163 shouldBe('focusedElement()', '".calendar-navigation-button today-button"'); 163 shouldBeEqualToString('focusedElement()', '.calendar-navigation-button today -button');
164 eventSender.keyDown('\t', ['shiftKey']); 164 eventSender.keyDown('\t', ['shiftKey']);
165 shouldBe('focusedElement()', '".calendar-navigation-button"'); 165 shouldBeEqualToString('focusedElement()', '.calendar-navigation-button');
166 eventSender.keyDown('\t', ['shiftKey']); 166 eventSender.keyDown('\t', ['shiftKey']);
167 shouldBe('focusedElement()', '".month-popup-button"'); 167 shouldBeEqualToString('focusedElement()', '.month-popup-button');
168 168
169 debug('open the month popup'); 169 debug('open the month popup');
170 eventSender.keyDown('\n'); 170 eventSender.keyDown('\n');
171 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible'); 171 shouldBeTrue('popupWindow.global.picker.monthPopupView.isVisible');
172 shouldBeEqualToString('highlightedMonthButton()', '2000-02'); 172 shouldBeEqualToString('highlightedMonthButton()', '2000-02');
173 173
174 debug("press down"); 174 debug("press down");
175 eventSender.keyDown('downArrow'); 175 eventSender.keyDown('downArrow');
176 shouldBeEqualToString('highlightedMonthButton()', '2000-06'); 176 shouldBeEqualToString('highlightedMonthButton()', '2000-06');
177 177
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 shouldBeEqualToString('highlightedDayCells()', ''); 221 shouldBeEqualToString('highlightedDayCells()', '');
222 222
223 debug("focus calendar table"); 223 debug("focus calendar table");
224 popupWindow.global.picker.calendarTableView.element.focus(); 224 popupWindow.global.picker.calendarTableView.element.focus();
225 225
226 // Test twice in case midnight. 226 // Test twice in case midnight.
227 debug("press t"); 227 debug("press t");
228 shouldBeTrue('testToday() || testToday()'); 228 shouldBeTrue('testToday() || testToday()');
229 229
230 debug("press esc"); 230 debug("press esc");
231 eventSender.keyDown('\x1B'); 231 eventSender.keyDown('escape');
232 waitUntilClosing(test2AfterClosing); 232 waitUntilClosing(test2AfterClosing);
233 } 233 }
234 234
235 function test2AfterClosing() { 235 function test2AfterClosing() {
236 shouldBeNull('document.getElementById("mock-page-popup")'); 236 shouldBeNull('document.getElementById("mock-page-popup")');
237 237
238 finishJSTest(); 238 finishJSTest();
239 } 239 }
240 240
241 function testToday() { 241 function testToday() {
(...skipping 10 matching lines...) Expand all
252 return null; 252 return null;
253 var identifier = "." + element.className; 253 var identifier = "." + element.className;
254 if (element.value) 254 if (element.value)
255 identifier += "[value=" + element.value + "]"; 255 identifier += "[value=" + element.value + "]";
256 return identifier; 256 return identifier;
257 } 257 }
258 258
259 </script> 259 </script>
260 </body> 260 </body>
261 </html> 261 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698