Chromium Code Reviews| 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..204e39d5ac9a30470247668093079a834e21b35a 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; |
|
calamity
2017/06/22 05:15:33
Oh boy.
tsergeant
2017/06/22 07:47:31
Acknowledged.
|
| + bulkChildren.push(createItem(id, {url: 'http://' + id + '/'})); |
|
calamity
2017/06/22 05:15:33
nit: `http://${id}/`
tsergeant
2017/06/22 07:47:31
Done.
|
| + } |
| + |
| 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.get(); |
|
calamity
2017/06/22 05:15:33
nit: getIfExists?
tsergeant
2017/06/22 07:47:31
Done.
|
| + 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)); |