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

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

Issue 2885723002: [MD Bookmarks] Add keyboard navigation and selection to bookmark list. (Closed)
Patch Set: address comments Created 3 years, 7 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 // 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 suite('selection state', function() { 5 suite('selection state', function() {
6 var selection; 6 var selection;
7 var action; 7 var action;
8 8
9 function select(items, anchor, clear, toggle) { 9 function select(items, anchor, clear, toggle) {
10 return { 10 return {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 test('toggle an item', function() { 92 test('toggle an item', function() {
93 action = select(['1', '2', '3'], '3', true, false); 93 action = select(['1', '2', '3'], '3', true, false);
94 selection = bookmarks.SelectionState.updateSelection(selection, action); 94 selection = bookmarks.SelectionState.updateSelection(selection, action);
95 95
96 action = select(['1'], '3', false, true); 96 action = select(['1'], '3', false, true);
97 selection = bookmarks.SelectionState.updateSelection(selection, action); 97 selection = bookmarks.SelectionState.updateSelection(selection, action);
98 assertDeepEquals(['2', '3'], normalizeSet(selection.items)); 98 assertDeepEquals(['2', '3'], normalizeSet(selection.items));
99 }); 99 });
100 100
101 test('update anchor', function() {
102 action = bookmarks.actions.updateAnchor('3');
103 selection = bookmarks.SelectionState.updateSelection(selection, action);
104
105 assertEquals('3', selection.anchor);
106 });
107
101 test('deselects items when they are deleted', function() { 108 test('deselects items when they are deleted', function() {
102 var nodeMap = testTree(createFolder('0', [ 109 var nodeMap = testTree(createFolder('0', [
103 createFolder( 110 createFolder(
104 '1', 111 '1',
105 [ 112 [
106 createItem('2'), 113 createItem('2'),
107 createItem('3'), 114 createItem('3'),
108 createItem('4'), 115 createItem('4'),
109 ]), 116 ]),
110 createItem('5'), 117 createItem('5'),
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 state = bookmarks.reduceAction(state, action); 441 state = bookmarks.reduceAction(state, action);
435 442
436 action = bookmarks.actions.removeBookmark('2', '1', 0, state.nodes); 443 action = bookmarks.actions.removeBookmark('2', '1', 0, state.nodes);
437 state = bookmarks.reduceAction(state, action); 444 state = bookmarks.reduceAction(state, action);
438 445
439 // 2 and 3 should be removed, since 2 was deleted and 3 was a descendant of 446 // 2 and 3 should be removed, since 2 was deleted and 3 was a descendant of
440 // 2. 447 // 2.
441 assertDeepEquals(['1'], state.search.results); 448 assertDeepEquals(['1'], state.search.results);
442 }); 449 });
443 }); 450 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js ('k') | third_party/polymer/v1_0/chromium.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698