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

Side by Side Diff: chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js

Issue 2924673003: [MD Bookmarks] Make shift-selection behave well with no anchor. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « chrome/browser/resources/md_bookmarks/list.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Tests for MD Bookmarks which are run as interactive ui tests. 6 * @fileoverview Tests for MD Bookmarks which are run as interactive ui tests.
7 * Should be used for tests which care about focus. 7 * Should be used for tests which care about focus.
8 */ 8 */
9 9
10 var ROOT_PATH = '../../../../../'; 10 var ROOT_PATH = '../../../../../';
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 keydown(focusedItem, 'Escape'); 258 keydown(focusedItem, 'Escape');
259 assertDeepEquals([], normalizeSet(store.data.selection.items)); 259 assertDeepEquals([], normalizeSet(store.data.selection.items));
260 260
261 keydown(focusedItem, 'a', 'ctrl'); 261 keydown(focusedItem, 'a', 'ctrl');
262 assertDeepEquals( 262 assertDeepEquals(
263 ['2', '3', '4', '5', '6', '7'], 263 ['2', '3', '4', '5', '6', '7'],
264 normalizeSet(store.data.selection.items)); 264 normalizeSet(store.data.selection.items));
265 }); 265 });
266 266
267 test('shift selection', function() { 267 test('shift selection', function() {
268 // TODO(calamity): Make the first item the anchor index when a new folder
269 // is selected.
270 var focusedItem = items[0]; 268 var focusedItem = items[0];
271 focusedItem.focus(); 269 focusedItem.focus();
272 270
273 keydown(focusedItem, 'ArrowDown'); 271 keydown(focusedItem, 'ArrowDown', 'shift');
274 focusedItem = items[1]; 272 focusedItem = items[1];
275 assertDeepEquals(['3'], normalizeSet(store.data.selection.items)); 273 assertDeepEquals(['2', '3'], normalizeSet(store.data.selection.items));
274
275 keydown(focusedItem, 'Escape');
276 focusedItem = items[1];
277 assertDeepEquals([], normalizeSet(store.data.selection.items));
276 278
277 keydown(focusedItem, 'ArrowUp', 'shift'); 279 keydown(focusedItem, 'ArrowUp', 'shift');
278 focusedItem = items[0]; 280 focusedItem = items[0];
279 assertDeepEquals(['2', '3'], normalizeSet(store.data.selection.items)); 281 assertDeepEquals(['2', '3'], normalizeSet(store.data.selection.items));
280 282
281 keydown(focusedItem, 'ArrowDown', 'shift'); 283 keydown(focusedItem, 'ArrowDown', 'shift');
282 focusedItem = items[1]; 284 focusedItem = items[1];
283 assertDeepEquals(['3'], normalizeSet(store.data.selection.items)); 285 assertDeepEquals(['3'], normalizeSet(store.data.selection.items));
284 286
285 keydown(focusedItem, 'ArrowDown', 'shift'); 287 keydown(focusedItem, 'ArrowDown', 'shift');
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 343
342 keydown(focusedItem, 'ArrowDown', ['ctrl', 'shift']); 344 keydown(focusedItem, 'ArrowDown', ['ctrl', 'shift']);
343 focusedItem = items[3]; 345 focusedItem = items[3];
344 assertDeepEquals( 346 assertDeepEquals(
345 ['2', '4', '5', '6'], normalizeSet(store.data.selection.items)); 347 ['2', '4', '5', '6'], normalizeSet(store.data.selection.items));
346 }); 348 });
347 }); 349 });
348 350
349 mocha.run(); 351 mocha.run();
350 }); 352 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698