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

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

Issue 2774233006: [MD Bookmarks] Change selection items from Map to Set. (Closed)
Patch Set: rebase 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
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 5054a8511c11b1211777d0e799b6617d08f2a7e3..fdf838f646d5ba2536f59bcf84f7f58bfcb79380 100644
--- a/chrome/test/data/webui/md_bookmarks/reducers_test.js
+++ b/chrome/test/data/webui/md_bookmarks/reducers_test.js
@@ -26,30 +26,30 @@ suite('selection state', function() {
action = select(['1'], '1', false);
state = bookmarks.SelectionState.updateSelection(state, action);
- assertDeepEquals({'1': true}, state.items);
+ assertDeepEquals(['1'], normalizeSet(state.items));
assertEquals('1', state.anchor);
// Replace current selection.
action = select(['2'], '2', false);
state = bookmarks.SelectionState.updateSelection(state, action);
- assertDeepEquals({'2': true}, state.items);
+ assertDeepEquals(['2'], normalizeSet(state.items));
assertEquals('2', state.anchor);
// Add to current selection.
action = select(['3'], '3', true);
state = bookmarks.SelectionState.updateSelection(state, action);
- assertDeepEquals({'2': true, '3': true}, state.items);
+ assertDeepEquals(['2', '3'], normalizeSet(state.items));
assertEquals('3', state.anchor);
});
test('can select multiple items', function() {
action = select(['1', '2', '3'], '3', false);
state = bookmarks.SelectionState.updateSelection(state, action);
- assertDeepEquals({'1': true, '2': true, '3': true}, state.items);
+ assertDeepEquals(['1', '2', '3'], normalizeSet(state.items));
action = select(['3', '4'], '4', true);
state = bookmarks.SelectionState.updateSelection(state, action);
- assertDeepEquals({'1': true, '2': true, '3': true, '4': true}, state.items);
+ assertDeepEquals(['1', '2', '3', '4'], normalizeSet(state.items));
});
test('is cleared when selected folder changes', function() {
@@ -103,15 +103,15 @@ suite('closed folder state', function() {
createItem('3'),
]),
createFolder('4', []));
- state = {};
+ state = new Set();
});
test('toggle folder open state', function() {
action = bookmarks.actions.changeFolderOpen('2', false);
state =
bookmarks.ClosedFolderState.updateClosedFolders(state, action, nodes);
- assertFalse(!!state['1']);
- assertTrue(state['2']);
+ assertFalse(state.has('1'));
+ assertTrue(state.has('2'));
});
test('select folder with closed parent', function() {
@@ -119,32 +119,32 @@ suite('closed folder state', function() {
action = bookmarks.actions.changeFolderOpen('1', false);
state =
bookmarks.ClosedFolderState.updateClosedFolders(state, action, nodes);
- assertTrue(state['1']);
- assertFalse(!!state['2']);
+ assertTrue(state.has('1'));
+ assertFalse(state.has('2'));
// Should re-open when '2' is selected.
action = bookmarks.actions.selectFolder('2');
state =
bookmarks.ClosedFolderState.updateClosedFolders(state, action, nodes);
- assertFalse(!!state['1']);
+ assertFalse(state.has('1'));
});
test('move nodes in a closed folder', function() {
// Moving bookmark items should not open folders.
- state = {'1': true};
+ state = new Set(['1']);
action = bookmarks.actions.moveBookmark('3', '1', 1, '1', 0);
state =
bookmarks.ClosedFolderState.updateClosedFolders(state, action, nodes);
- assertTrue(state['1']);
+ assertTrue(state.has('1'));
// Moving folders should open their parents.
- state = {'1': true, '2': true};
+ state = new Set(['1', '2']);
action = bookmarks.actions.moveBookmark('4', '2', 0, '0', 1);
state =
bookmarks.ClosedFolderState.updateClosedFolders(state, action, nodes);
- assertFalse(!!state['1']);
- assertFalse(!!state['2']);
+ assertFalse(state.has('1'));
+ assertFalse(state.has('2'));
});
});
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/dnd_manager_test.js ('k') | chrome/test/data/webui/md_bookmarks/test_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698