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); |