OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 suite('<bookmarks-command-manager>', function() { | |
6 var commandManager; | |
7 var store; | |
8 | |
9 setup(function() { | |
10 store = new bookmarks.TestStore({ | |
11 nodes: testTree(createFolder( | |
12 '1', | |
13 [ | |
14 createFolder('11', []), | |
15 createFolder('12', []), | |
16 createItem('13'), | |
17 ])), | |
18 }); | |
19 bookmarks.Store.instance_ = store; | |
20 | |
21 commandManager = document.createElement('bookmarks-command-manager'); | |
22 replaceBody(commandManager); | |
23 }); | |
24 | |
25 test('canCopy only single URLs', function() { | |
calamity
2017/04/24 05:20:35
nit: single URL items
tsergeant
2017/04/24 07:28:23
Done.
| |
26 assertFalse(commandManager.canCopy(new Set(['11']))); | |
27 assertFalse(commandManager.canCopy(new Set(['11', '13']))); | |
28 assertTrue(commandManager.canCopy(new Set(['13']))); | |
29 }); | |
30 | |
31 test('context menu hides invalid commands', function() { | |
32 store.data.selection.items = new Set(['11', '13']); | |
33 store.notifyObservers(); | |
34 | |
35 commandManager.openCommandMenuAtPosition(0, 0); | |
36 var commandHidden = {}; | |
37 commandManager.root.querySelectorAll('.dropdown-item').forEach(element => { | |
38 commandHidden[element.getAttribute('command')] = element.hidden; | |
39 }); | |
40 | |
41 // With a folder and an item selected, the only available context menu item | |
42 // is 'Delete'. | |
43 assertTrue(commandHidden['edit']); | |
44 assertTrue(commandHidden['copy']); | |
45 assertFalse(commandHidden['delete']); | |
46 }); | |
47 }); | |
OLD | NEW |