| OLD | NEW |
| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 MockInteractions.pressAndReleaseKeyOn( | 158 MockInteractions.pressAndReleaseKeyOn( |
| 159 document.body, '', undoModifier, undoKey); | 159 document.body, '', undoModifier, undoKey); |
| 160 commandManager.assertLastCommand('undo'); | 160 commandManager.assertLastCommand('undo'); |
| 161 | 161 |
| 162 MockInteractions.pressAndReleaseKeyOn( | 162 MockInteractions.pressAndReleaseKeyOn( |
| 163 document.body, '', redoModifier, redoKey); | 163 document.body, '', redoModifier, redoKey); |
| 164 commandManager.assertLastCommand('redo'); | 164 commandManager.assertLastCommand('redo'); |
| 165 }); | 165 }); |
| 166 | 166 |
| 167 test('Show In Folder is only available during search', function() { |
| 168 assertFalse( |
| 169 commandManager.canExecute(Command.SHOW_IN_FOLDER, new Set(['12']))); |
| 170 |
| 171 store.data.search.term = 'test'; |
| 172 store.data.search.results = ['12', '13']; |
| 173 store.notifyObservers(); |
| 174 |
| 175 assertTrue( |
| 176 commandManager.canExecute(Command.SHOW_IN_FOLDER, new Set(['12']))); |
| 177 assertFalse( |
| 178 commandManager.canExecute(Command.SHOW_IN_FOLDER, new Set(['1']))); |
| 179 assertFalse(commandManager.canExecute( |
| 180 Command.SHOW_IN_FOLDER, new Set(['12', '13']))); |
| 181 |
| 182 commandManager.handle(Command.SHOW_IN_FOLDER, new Set(['12'])); |
| 183 assertEquals('select-folder', store.lastAction.name); |
| 184 assertEquals('1', store.lastAction.id); |
| 185 }); |
| 186 |
| 167 test('does not delete children at same time as ancestor', function() { | 187 test('does not delete children at same time as ancestor', function() { |
| 168 var lastDelete = null; | 188 var lastDelete = null; |
| 169 chrome.bookmarkManagerPrivate.removeTrees = function(idArray) { | 189 chrome.bookmarkManagerPrivate.removeTrees = function(idArray) { |
| 170 lastDelete = idArray.sort(); | 190 lastDelete = idArray.sort(); |
| 171 }; | 191 }; |
| 172 | 192 |
| 173 var parentAndChildren = new Set(['11', '12', '111', '1221']); | 193 var parentAndChildren = new Set(['11', '12', '111', '1221']); |
| 174 assertTrue(commandManager.canExecute(Command.DELETE, parentAndChildren)); | 194 assertTrue(commandManager.canExecute(Command.DELETE, parentAndChildren)); |
| 175 commandManager.handle(Command.DELETE, parentAndChildren); | 195 commandManager.handle(Command.DELETE, parentAndChildren); |
| 176 | 196 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 assertOpenedTabs(['http://111/', 'http://12/']); | 396 assertOpenedTabs(['http://111/', 'http://12/']); |
| 377 }); | 397 }); |
| 378 | 398 |
| 379 test('control-double click opens full selection', function() { | 399 test('control-double click opens full selection', function() { |
| 380 customClick(items[0]); | 400 customClick(items[0]); |
| 381 simulateDoubleClick(items[2], {ctrlKey: true}); | 401 simulateDoubleClick(items[2], {ctrlKey: true}); |
| 382 | 402 |
| 383 assertOpenedTabs(['http://111/', 'http://13/']); | 403 assertOpenedTabs(['http://111/', 'http://13/']); |
| 384 }); | 404 }); |
| 385 }); | 405 }); |
| OLD | NEW |