| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // No divider line should be visible when only 'Open' commands are enabled. | 257 // No divider line should be visible when only 'Open' commands are enabled. |
| 258 commandManager.openCommandMenuAtPosition(0, 0); | 258 commandManager.openCommandMenuAtPosition(0, 0); |
| 259 commandManager.root.querySelectorAll('hr').forEach(element => { | 259 commandManager.root.querySelectorAll('hr').forEach(element => { |
| 260 assertTrue(element.hidden); | 260 assertTrue(element.hidden); |
| 261 }); | 261 }); |
| 262 }); | 262 }); |
| 263 | 263 |
| 264 test('cannot edit unmodifiable nodes', function() { | 264 test('cannot edit unmodifiable nodes', function() { |
| 265 // Cannot edit root folders. | 265 // Cannot edit root folders. |
| 266 var items = new Set(['1']); | 266 var items = new Set(['1']); |
| 267 store.data.selection.items = items; |
| 267 assertFalse(commandManager.canExecute(Command.EDIT, items)); | 268 assertFalse(commandManager.canExecute(Command.EDIT, items)); |
| 268 assertFalse(commandManager.canExecute(Command.DELETE, items)); | 269 assertFalse(commandManager.canExecute(Command.DELETE, items)); |
| 269 | 270 |
| 270 store.data.nodes['12'].unmodifiable = 'managed'; | 271 store.data.nodes['12'].unmodifiable = 'managed'; |
| 271 store.notifyObservers(); | 272 store.notifyObservers(); |
| 272 | 273 |
| 273 items = new Set(['12']); | 274 items = new Set(['12']); |
| 274 assertFalse(commandManager.canExecute(Command.EDIT, items)); | 275 assertFalse(commandManager.canExecute(Command.EDIT, items)); |
| 275 assertFalse(commandManager.canExecute(Command.DELETE, items)); | 276 assertFalse(commandManager.canExecute(Command.DELETE, items)); |
| 277 |
| 278 commandManager.openCommandMenuAtPosition(0, 0); |
| 279 var commandItem = {}; |
| 280 commandManager.root.querySelectorAll('.dropdown-item').forEach(element => { |
| 281 commandItem[element.getAttribute('command')] = element; |
| 282 }); |
| 283 MockInteractions.tap(commandItem[Command.EDIT]); |
| 284 commandManager.assertLastCommand(null); |
| 276 }); | 285 }); |
| 277 }); | 286 }); |
| 278 | 287 |
| 279 suite('<bookmarks-item> CommandManager integration', function() { | 288 suite('<bookmarks-item> CommandManager integration', function() { |
| 280 var list; | 289 var list; |
| 281 var items; | 290 var items; |
| 282 var commandManager; | 291 var commandManager; |
| 283 var openedTabs; | 292 var openedTabs; |
| 284 | 293 |
| 285 setup(function() { | 294 setup(function() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 assertOpenedTabs(['http://111/', 'http://12/']); | 354 assertOpenedTabs(['http://111/', 'http://12/']); |
| 346 }); | 355 }); |
| 347 | 356 |
| 348 test('control-double click opens full selection', function() { | 357 test('control-double click opens full selection', function() { |
| 349 customClick(items[0]); | 358 customClick(items[0]); |
| 350 simulateDoubleClick(items[2], {ctrlKey: true}); | 359 simulateDoubleClick(items[2], {ctrlKey: true}); |
| 351 | 360 |
| 352 assertOpenedTabs(['http://111/', 'http://13/']); | 361 assertOpenedTabs(['http://111/', 'http://13/']); |
| 353 }); | 362 }); |
| 354 }); | 363 }); |
| OLD | NEW |