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

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

Issue 2813503002: MD Bookmarks: Prevent navigating to invalid folders (Closed)
Patch Set: handleAction -> dispatch 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 /** 5 /**
6 * @fileoverview Test suite for action creators that depend on the page state 6 * @fileoverview Test suite for action creators that depend on the page state
7 * and/or have non-trivial logic. 7 * and/or have non-trivial logic.
8 */ 8 */
9 9
10 suite('selectItem', function() { 10 suite('selectItem', function() {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 assertDeepEquals(['4'], action.items); 67 assertDeepEquals(['4'], action.items);
68 68
69 // Anchor set to an item which doesn't exist. 69 // Anchor set to an item which doesn't exist.
70 store.data.selection.anchor = '42'; 70 store.data.selection.anchor = '42';
71 71
72 action = bookmarks.actions.selectItem('8', true, true, store.data); 72 action = bookmarks.actions.selectItem('8', true, true, store.data);
73 assertEquals('8', action.anchor); 73 assertEquals('8', action.anchor);
74 assertDeepEquals(['8'], action.items); 74 assertDeepEquals(['8'], action.items);
75 }); 75 });
76 }); 76 });
77
78 test('selectFolder prevents selecting invalid nodes', function() {
79 var nodes = testTree(createFolder('1', [
80 createItem('2'),
81 ]));
82
83 var action = bookmarks.actions.selectFolder(ROOT_NODE_ID, nodes);
84 assertEquals(null, action);
85
86 action = bookmarks.actions.selectFolder('2', nodes);
87 assertEquals(null, action);
88
89 action = bookmarks.actions.selectFolder('42', nodes);
90 assertEquals(null, action);
91
92 action = bookmarks.actions.selectFolder('1', nodes);
93 assertEquals('select-folder', action.name);
94 assertEquals('1', action.id);
95 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/types.js ('k') | chrome/test/data/webui/md_bookmarks/router_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698