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

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

Issue 2741393002: MD Bookmarks: Implement item selection in new data flow system (Closed)
Patch Set: Review comments Created 3 years, 9 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/resources/md_bookmarks/util.js ('k') | chrome/test/data/webui/md_bookmarks/reducers_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ });
});
« no previous file with comments | « chrome/browser/resources/md_bookmarks/util.js ('k') | chrome/test/data/webui/md_bookmarks/reducers_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698