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

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

Issue 2945513002: MD Bookmarks: Add a confirmation dialog before opening many tabs (Closed)
Patch Set: Review comments Created 3 years, 6 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/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc ('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 eb844b95d965ba26e534712ee4a8b6d8203ac54b..68bf6b66b50e47cc97b004f3321ecca6ddf94ffb 100644
--- a/chrome/test/data/webui/md_bookmarks/command_manager_test.js
+++ b/chrome/test/data/webui/md_bookmarks/command_manager_test.js
@@ -16,6 +16,12 @@ suite('<bookmarks-command-manager>', function() {
});
setup(function() {
+ var bulkChildren = [];
+ for (var i = 1; i <= 20; i++) {
+ var id = '3' + i;
+ bulkChildren.push(createItem(id, {url: `http://${id}/`}));
+ }
+
store = new bookmarks.TestStore({
nodes: testTree(
createFolder(
@@ -42,7 +48,8 @@ suite('<bookmarks-command-manager>', function() {
'2',
[
createFolder('21', []),
- ]))
+ ]),
+ createFolder('3', bulkChildren)),
});
store.replaceSingleton();
@@ -181,6 +188,36 @@ suite('<bookmarks-command-manager>', function() {
commandManager.assertLastCommand(Command.OPEN_NEW_WINDOW);
});
+ test('opening many items causes a confirmation dialog', function() {
+ var lastCreate = null;
+ chrome.windows.create = function(createConfig) {
+ lastCreate = createConfig;
+ };
+
+ var items = new Set(['3']);
+ assertTrue(commandManager.canExecute(Command.OPEN_NEW_WINDOW, items));
+
+ commandManager.handle(Command.OPEN_NEW_WINDOW, items);
+ // No window should be created right away.
+ assertEquals(null, lastCreate);
+
+ var dialog = commandManager.$.openDialog.getIfExists();
+ assertTrue(dialog.open);
+
+ // Pressing 'cancel' should not open the window.
+ MockInteractions.tap(dialog.querySelector('.cancel-button'));
+ assertFalse(dialog.open);
+ assertEquals(null, lastCreate);
+
+ commandManager.handle(Command.OPEN_NEW_WINDOW, items);
+ assertTrue(dialog.open);
+
+ // Pressing 'yes' will open all the URLs.
+ MockInteractions.tap(dialog.querySelector('.action-button'));
+ assertFalse(dialog.open);
+ assertEquals(20, lastCreate.url.length);
+ });
+
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));
« no previous file with comments | « chrome/browser/ui/webui/md_bookmarks/md_bookmarks_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698