| Index: chrome/test/data/webui/md_bookmarks/list_test.js
|
| diff --git a/chrome/test/data/webui/md_bookmarks/list_test.js b/chrome/test/data/webui/md_bookmarks/list_test.js
|
| index 62de4f3e6d6a35d3466ccee0137733037629c630..a2cd6f9ccd61e2154b16d11056a05dac81cf9154 100644
|
| --- a/chrome/test/data/webui/md_bookmarks/list_test.js
|
| +++ b/chrome/test/data/webui/md_bookmarks/list_test.js
|
| @@ -65,4 +65,53 @@ suite('<bookmarks-list>', function() {
|
|
|
| assertDeepEquals(['1', '3', '5', '7'], ids);
|
| });
|
| +
|
| + test('selects individual items', function() {
|
| + var items = list.root.querySelectorAll('bookmarks-item');
|
| +
|
| + customClick(items[0]);
|
| + var expected = {
|
| + name: 'select-items',
|
| + add: false,
|
| + anchor: '1',
|
| + items: ['1'],
|
| + };
|
| + assertDeepEquals(expected, store.lastAction);
|
| +
|
| + customClick(items[2], {ctrlKey: true});
|
| + expected.add = true;
|
| + expected.anchor = '5';
|
| + expected.items = ['5'];
|
| + assertDeepEquals(expected, store.lastAction);
|
| + });
|
| +
|
| + test('shift-selects multiple items', function() {
|
| + var items = list.root.querySelectorAll('bookmarks-item');
|
| + store.data.selection.anchor = '1';
|
| +
|
| + customClick(items[2], {shiftKey: true});
|
| +
|
| + assertEquals('select-items', store.lastAction.name);
|
| + assertFalse(store.lastAction.add);
|
| + assertEquals('5', store.lastAction.anchor);
|
| + assertDeepEquals(['1', '3', '5'], store.lastAction.items);
|
| + });
|
| +
|
| + test('selects the item when the anchor is missing', function() {
|
| + var items = list.root.querySelectorAll('bookmarks-item');
|
| + // Anchor hasn't been set yet:
|
| + store.data.selection.anchor = null;
|
| +
|
| + customClick(items[0], {shiftKey: true});
|
| + assertEquals('1', store.lastAction.anchor);
|
| + assertDeepEquals(['1'], store.lastAction.items);
|
| +
|
| + // Anchor item doesn't exist:
|
| + store.data.selection.anchor = '42';
|
| +
|
| + customClick(items[1], {shiftKey: true});
|
| +
|
| + assertEquals('3', store.lastAction.anchor);
|
| + assertDeepEquals(['3'], store.lastAction.items);
|
| + });
|
| });
|
|
|