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

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

Issue 2808333004: MD Bookmarks: Improve test coverage for Actions and Routing (Closed)
Patch Set: Remove .only Created 3 years, 8 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
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 4a3328704364fce5a7a2b0a84865fcefe87e3e90..ff6b2a3cb77eb217376b105163333dd523b6e614 100644
--- a/chrome/test/data/webui/md_bookmarks/list_test.js
+++ b/chrome/test/data/webui/md_bookmarks/list_test.js
@@ -32,53 +32,23 @@ 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});
+ customClick(items[0]);
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});
+ store.data.selection.anchor = '1';
+ customClick(items[2], {shiftKey: true, ctrlKey: true});
- assertEquals('3', store.lastAction.anchor);
- assertDeepEquals(['3'], store.lastAction.items);
+ assertEquals('select-items', store.lastAction.name);
+ assertTrue(store.lastAction.add);
+ assertEquals('5', store.lastAction.anchor);
+ assertDeepEquals(['1', '3', '5'], store.lastAction.items);
});
test('deselects items on click outside of card', function() {
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/actions_test.js ('k') | chrome/test/data/webui/md_bookmarks/md_bookmarks_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698