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

Unified Diff: chrome/test/data/webui/md_bookmarks/command_manager_test.js

Issue 2864993002: MD Bookmarks: Add commands for 'Open in <x>' menu items (Closed)
Patch Set: Review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/api/_api_features.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/md_bookmarks/command_manager_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/command_manager_test.js b/chrome/test/data/webui/md_bookmarks/command_manager_test.js
index c0b993b10b610861bd39a54401e8f121f881077f..14b6d28203d7f0f0c18cf5733f94c425882cb120 100644
--- a/chrome/test/data/webui/md_bookmarks/command_manager_test.js
+++ b/chrome/test/data/webui/md_bookmarks/command_manager_test.js
@@ -32,12 +32,20 @@ suite('<bookmarks-command-manager>', function() {
createFolder(
'11',
[
- createItem('111'),
+ createItem('111', {url: 'http://111/'}),
]),
- createFolder('12', []),
- createItem('13'),
+ createFolder(
+ '12',
+ [
+ createItem('121', {url: 'http://121/'}),
+ ]),
+ createItem('13', {url: 'http://13/'}),
]),
- createFolder('2', [])),
+ createFolder(
+ '2',
+ [
+ createFolder('21', []),
+ ]))
});
bookmarks.Store.instance_ = store;
@@ -50,6 +58,8 @@ suite('<bookmarks-command-manager>', function() {
realHandle(command, itemIds);
};
replaceBody(commandManager);
+
+ Polymer.dom.flush();
});
test('can only copy single URL items', function() {
@@ -130,4 +140,49 @@ suite('<bookmarks-command-manager>', function() {
assertDeepEquals(['1', '2'], lastDelete);
});
+
+ test('expandUrls_ expands one level of URLs', function() {
+ var urls = commandManager.expandUrls_(new Set(['1']));
+ assertDeepEquals(['http://13/'], urls);
+
+ urls = commandManager.expandUrls_(new Set(['11', '12', '13']));
+ assertDeepEquals(['http://111/', 'http://121/', 'http://13/'], urls);
+ });
+
+ test('shift-enter opens URLs in new window', function() {
+ store.data.selection.items = new Set(['12', '13']);
+ store.notifyObservers();
+
+ var lastCreate;
+ chrome.windows.create = function(createConfig) {
+ lastCreate = createConfig;
+ };
+
+ MockInteractions.pressAndReleaseKeyOn(document, 13, 'shift', 'Enter');
+ assertLastCommand(Command.OPEN_NEW_WINDOW, ['12', '13']);
+ assertDeepEquals(['http://121/', 'http://13/'], lastCreate.url);
+ assertFalse(lastCreate.incognito);
+ });
+
+ test('cannot execute "Open in New Tab" on folders with no items', function() {
+ var items = new Set(['2']);
+ assertFalse(commandManager.canExecute(Command.OPEN_NEW_TAB, items));
+
+ store.data.selection.items = items;
+
+ commandManager.openCommandMenuAtPosition(0, 0);
+ var commandItem = {};
+ commandManager.root.querySelectorAll('.dropdown-item').forEach(element => {
+ commandItem[element.getAttribute('command')] = element;
+ });
+
+ assertTrue(commandItem[Command.OPEN_NEW_TAB].disabled);
+ assertFalse(commandItem[Command.OPEN_NEW_TAB].hidden);
+
+ assertTrue(commandItem[Command.OPEN_NEW_WINDOW].disabled);
+ assertFalse(commandItem[Command.OPEN_NEW_WINDOW].hidden);
+
+ assertTrue(commandItem[Command.OPEN_INCOGNITO].disabled);
+ assertFalse(commandItem[Command.OPEN_INCOGNITO].hidden);
+ });
});
« no previous file with comments | « chrome/common/extensions/api/_api_features.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698