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

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

Issue 2901463002: [MD Bookmarks] Add undo/redo functionality to MD Bookmarks. (Closed)
Patch Set: fix DEPS 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
« no previous file with comments | « chrome/browser/resources/md_bookmarks/constants.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 suite('<bookmarks-command-manager>', function() { 5 suite('<bookmarks-command-manager>', function() {
6 var commandManager; 6 var commandManager;
7 var store; 7 var store;
8 var lastCommand; 8 var lastCommand;
9 var lastCommandIds; 9 var lastCommandIds;
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 var key = cr.isMac ? 'Enter' : 'F2'; 106 var key = cr.isMac ? 'Enter' : 'F2';
107 var keyCode = cr.isMac ? 13 : 113; 107 var keyCode = cr.isMac ? 13 : 113;
108 108
109 store.data.selection.items = new Set(['11']); 109 store.data.selection.items = new Set(['11']);
110 store.notifyObservers(); 110 store.notifyObservers();
111 111
112 MockInteractions.pressAndReleaseKeyOn(document, keyCode, '', key); 112 MockInteractions.pressAndReleaseKeyOn(document, keyCode, '', key);
113 commandManager.assertLastCommand('edit', ['11']); 113 commandManager.assertLastCommand('edit', ['11']);
114 }); 114 });
115 115
116 test('undo and redo commands trigger', function() {
117 var undoModifier = cr.isMac ? 'meta' : 'ctrl';
118 var undoKey = 'z';
119 var redoModifier = cr.isMac ? ['meta', 'shift'] : 'ctrl'
120 var redoKey = cr.isMac ? 'z' : 'y';
121
122 MockInteractions.pressAndReleaseKeyOn(document, '', undoModifier, undoKey);
123 commandManager.assertLastCommand('undo');
124
125 MockInteractions.pressAndReleaseKeyOn(document, '', redoModifier, redoKey);
126 commandManager.assertLastCommand('redo');
127 });
128
116 test('does not delete children at same time as ancestor', function() { 129 test('does not delete children at same time as ancestor', function() {
117 var lastDelete = null; 130 var lastDelete = null;
118 chrome.bookmarkManagerPrivate.removeTrees = function(idArray) { 131 chrome.bookmarkManagerPrivate.removeTrees = function(idArray) {
119 lastDelete = idArray.sort(); 132 lastDelete = idArray.sort();
120 }; 133 };
121 134
122 var parentAndChildren = new Set(['1', '2', '12', '111']); 135 var parentAndChildren = new Set(['1', '2', '12', '111']);
123 assertTrue(commandManager.canExecute(Command.DELETE, parentAndChildren)); 136 assertTrue(commandManager.canExecute(Command.DELETE, parentAndChildren));
124 commandManager.handle(Command.DELETE, parentAndChildren); 137 commandManager.handle(Command.DELETE, parentAndChildren);
125 138
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 assertOpenedTabs(['http://111/', 'http://12/']); 254 assertOpenedTabs(['http://111/', 'http://12/']);
242 }); 255 });
243 256
244 test('control-double click opens full selection', function() { 257 test('control-double click opens full selection', function() {
245 customClick(items[0]); 258 customClick(items[0]);
246 simulateDoubleClick(items[2], {ctrlKey: true}); 259 simulateDoubleClick(items[2], {ctrlKey: true});
247 260
248 assertOpenedTabs(['http://111/', 'http://13/']); 261 assertOpenedTabs(['http://111/', 'http://13/']);
249 }); 262 });
250 }); 263 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/constants.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698