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

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

Issue 2834493006: MD Bookmarks: Pull context menu into separate element (Closed)
Patch Set: Rebase 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
OLDNEW
(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('can only copy single URL items', function() {
26 assertFalse(commandManager.canExecute(Command.COPY, new Set(['11'])));
27 assertFalse(commandManager.canExecute(Command.COPY, new Set(['11', '13'])));
28 assertTrue(commandManager.canExecute(Command.COPY, 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 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698