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

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

Issue 2670473002: [MD Bookmarks] Implement adding folders and bookmarks from toolbar menu. (Closed)
Patch Set: Fix store to insert node instead of push and update tests. Created 3 years, 10 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/store_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/store_test.js b/chrome/test/data/webui/md_bookmarks/store_test.js
index 554c23a06b7e00e10c5ff058a3557f17053d6909..22e0d5a669aa91298e01f752088cc0077f45cf4e 100644
--- a/chrome/test/data/webui/md_bookmarks/store_test.js
+++ b/chrome/test/data/webui/md_bookmarks/store_test.js
@@ -261,6 +261,29 @@ suite('<bookmarks-store>', function() {
assertEquals('http://www.google.com', store.idToNodeMap_['2'].url);
});
+ test('adding a folder updates tree with new node', function() {
+ chrome.bookmarks.create = function(info) {};
+
+ // Create a bookmark at end.
+ var parent = store.idToNodeMap_['8'];
+ var id = '9';
+ var config = {parentId: parent.id, index: parent.children.length};
+ store.onBookmarkCreated_(id, createItem(id, config));
+ var node = store.idToNodeMap_[id];
+ assertEquals(node, parent.children[config.index]);
+ assertEquals(parent.path + '.children.#' + config.index, node.path);
+ assertTrue('url' in node);
+
+ // Create a folder at the beginning.
+ var id = '10';
+ config = {parentId: parent.id, index: 0};
+ store.onBookmarkCreated_(id, createFolder(id, [], config));
+ node = store.idToNodeMap_[id];
+ assertEquals(node, parent.children[config.index]);
+ assertEquals(parent.path + '.children.#' + config.index, node.path);
+ assertFalse('url' in node);
+ });
+
test('folder gets updated after renaming', function() {
store.onBookmarkChanged_('3', {'title': 'Main Folder'});
assertEquals('Main Folder', store.idToNodeMap_['3'].title);

Powered by Google App Engine
This is Rietveld 408576698