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

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

Issue 2888863002: [MD Bookmarks] Refine mouse selection (Closed)
Patch Set: Created 3 years, 7 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/reducers_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/reducers_test.js b/chrome/test/data/webui/md_bookmarks/reducers_test.js
index 1eb6e77a600b73432630eac825bbf7452a70efbb..deffd59084ac29f54c7b669e996a0089dc7a998b 100644
--- a/chrome/test/data/webui/md_bookmarks/reducers_test.js
+++ b/chrome/test/data/webui/md_bookmarks/reducers_test.js
@@ -6,12 +6,13 @@ suite('selection state', function() {
var selection;
var action;
- function select(items, anchor, add) {
+ function select(items, anchor, add, toggle) {
return {
name: 'select-items',
add: add,
anchor: anchor,
items: items,
+ toggle: toggle,
};
}
@@ -23,37 +24,37 @@ suite('selection state', function() {
});
test('can select an item', function() {
- action = select(['1'], '1', false);
+ action = select(['1'], '1', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
assertDeepEquals(['1'], normalizeSet(selection.items));
assertEquals('1', selection.anchor);
// Replace current selection.
- action = select(['2'], '2', false);
+ action = select(['2'], '2', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
assertDeepEquals(['2'], normalizeSet(selection.items));
assertEquals('2', selection.anchor);
// Add to current selection.
- action = select(['3'], '3', true);
+ action = select(['3'], '3', true, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
assertDeepEquals(['2', '3'], normalizeSet(selection.items));
assertEquals('3', selection.anchor);
});
test('can select multiple items', function() {
- action = select(['1', '2', '3'], '3', false);
+ action = select(['1', '2', '3'], '3', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
assertDeepEquals(['1', '2', '3'], normalizeSet(selection.items));
- action = select(['3', '4'], '4', true);
+ action = select(['3', '4'], '4', true, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
assertDeepEquals(['1', '2', '3', '4'], normalizeSet(selection.items));
});
test('is cleared when selected folder changes', function() {
- action = select(['1', '2', '3'], '3', false);
+ action = select(['1', '2', '3'], '3', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
action = bookmarks.actions.selectFolder('2');
@@ -62,7 +63,7 @@ suite('selection state', function() {
});
test('is cleared when search finished', function() {
- action = select(['1', '2', '3'], '3', false);
+ action = select(['1', '2', '3'], '3', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
action = bookmarks.actions.setSearchResults(['2']);
@@ -71,7 +72,7 @@ suite('selection state', function() {
});
test('is cleared when search cleared', function() {
- action = select(['1', '2', '3'], '3', false);
+ action = select(['1', '2', '3'], '3', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
action = bookmarks.actions.clearSearch();
@@ -80,7 +81,7 @@ suite('selection state', function() {
});
test('deselect items', function() {
- action = select(['1', '2', '3'], '3', false);
+ action = select(['1', '2', '3'], '3', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
action = bookmarks.actions.deselectItems();
@@ -88,6 +89,15 @@ suite('selection state', function() {
assertDeepEquals({}, selection.items);
});
+ test('toggle an item', function() {
+ action = select(['1', '2', '3'], '3', false, false);
+ selection = bookmarks.SelectionState.updateSelection(selection, action);
+
+ action = select(['1'], '3', true, true);
+ selection = bookmarks.SelectionState.updateSelection(selection, action);
+ assertDeepEquals(['2', '3'], normalizeSet(selection.items));
+ });
+
test('deselects items when they are deleted', function() {
var nodeMap = testTree(createFolder('0', [
createFolder(
@@ -100,7 +110,7 @@ suite('selection state', function() {
createItem('5'),
]));
- action = select(['2', '4', '5'], '4', false);
+ action = select(['2', '4', '5'], '4', false, false);
selection = bookmarks.SelectionState.updateSelection(selection, action);
action = bookmarks.actions.removeBookmark('1', '0', 0, nodeMap);

Powered by Google App Engine
This is Rietveld 408576698