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

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

Issue 2795623002: MD Bookmarks: Handle bookmark creation (Closed)
Patch Set: Update test 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
« no previous file with comments | « chrome/browser/resources/md_bookmarks/util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fdf838f646d5ba2536f59bcf84f7f58bfcb79380..14203c24840638a2cf955789ff24972e5a2b486c 100644
--- a/chrome/test/data/webui/md_bookmarks/reducers_test.js
+++ b/chrome/test/data/webui/md_bookmarks/reducers_test.js
@@ -223,6 +223,36 @@ suite('node state', function() {
assertEquals(undefined, state['4'].url);
});
+ test('updates when a node is created', function() {
+ // Create a folder.
+ var folder = {
+ id: '6',
+ parentId: '1',
+ index: 2,
+ };
+ action = bookmarks.actions.createBookmark(folder.id, folder);
+ state = bookmarks.NodeState.updateNodes(state, action);
+
+ assertEquals('1', state['6'].parentId);
+ assertDeepEquals([], state['6'].children);
+ assertDeepEquals(['2', '3', '6', '4'], state['1'].children);
+
+ // Add a new item to that folder.
+ var item = {
+ id: '7',
+ parentId: '6',
+ index: 0,
+ url: 'https://www.example.com',
+ };
+
+ action = bookmarks.actions.createBookmark(item.id, item);
+ state = bookmarks.NodeState.updateNodes(state, action);
+
+ assertEquals('6', state['7'].parentId);
+ assertEquals(undefined, state['7'].children);
+ assertDeepEquals(['7'], state['6'].children);
+ });
+
test('updates when a node is deleted', function() {
action = bookmarks.actions.removeBookmark('3', '1', 1);
state = bookmarks.NodeState.updateNodes(state, action);
« no previous file with comments | « chrome/browser/resources/md_bookmarks/util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698