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

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

Issue 2926233002: MD Bookmarks: Add right-click context menu to sidebar folders (Closed)
Patch Set: Don't reselect folder 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/test/data/webui/md_bookmarks/folder_node_test.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 * Creates and returns a CommandManager which tracks what commands are executed. 6 * Creates and returns a CommandManager which tracks what commands are executed.
7 * @constructor 7 * @constructor
8 * @extends {bookmarks.CommandManager} 8 * @extends {bookmarks.CommandManager}
9 */ 9 */
10 function TestCommandManager() { 10 function TestCommandManager() {
11 var commandManager = document.createElement('bookmarks-command-manager'); 11 var commandManager = document.createElement('bookmarks-command-manager');
12 var lastCommand = null; 12 var lastCommand = null;
13 var lastCommandIds = null; 13 var lastCommandIds = null;
14 14
15 var realHandle = commandManager.handle.bind(commandManager); 15 var realHandle = commandManager.handle.bind(commandManager);
16 commandManager.handle = function(command, itemIds) { 16 commandManager.handle = function(command, itemIds) {
17 lastCommand = command; 17 lastCommand = command;
18 lastCommandIds = itemIds; 18 lastCommandIds = itemIds;
19 realHandle(command, itemIds); 19 realHandle(command, itemIds);
20 }; 20 };
21 21
22 commandManager.assertLastCommand = function (command, ids) { 22 /**
23 * @param {Command} command
24 * @param {!Array<string>} ids
25 */
26 commandManager.assertLastCommand = function(command, ids) {
23 assertEquals(command, lastCommand); 27 assertEquals(command, lastCommand);
24 if (ids) 28 if (ids)
25 assertDeepEquals(ids, normalizeSet(lastCommandIds)); 29 assertDeepEquals(ids, normalizeSet(lastCommandIds));
26 lastCommand = null; 30 lastCommand = null;
27 lastCommandIds = null; 31 lastCommandIds = null;
28 }; 32 };
29 33
34 /** @param {!Array<string>} ids */
35 commandManager.assertMenuOpenForIds = function(ids) {
36 assertDeepEquals(ids, normalizeSet(commandManager.menuIds_));
37 };
38
30 return commandManager; 39 return commandManager;
31 } 40 }
OLDNEW
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/folder_node_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698