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

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: Add node menu and 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 3f7470cf909a51deada4933263bbc4c6a1eaadf2..0d3c8b65bdf4471f3e6b3a2de4e1c9b9bc5138f6 100644
--- a/chrome/test/data/webui/md_bookmarks/store_test.js
+++ b/chrome/test/data/webui/md_bookmarks/store_test.js
@@ -251,6 +251,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.
+ var parent = store.idToNodeMap_['8'];
+ var id = '9';
+ store.onBookmarkCreated_(id, createItem(id, {parentId: parent.id}));
+ var lastIndex = parent.children.length - 1;
+ var node = store.idToNodeMap_[id];
+ assertEquals(node, parent.children[lastIndex]);
+ assertEquals(parent.path + '.children.#' + lastIndex, node.path);
+ assertTrue('url' in node);
+
+ // Create a folder.
+ var id = '10';
+ store.onBookmarkCreated_(id, createFolder(id, [], {parentId: parent.id}));
+ lastIndex = parent.children.length - 1;
+ node = store.idToNodeMap_[id];
+ assertEquals(node, parent.children[lastIndex]);
+ assertEquals(parent.path + '.children.#' + lastIndex, node.path);
+ assertFalse('url' in node);
+ });
+
//////////////////////////////////////////////////////////////////////////////
// search tests:

Powered by Google App Engine
This is Rietveld 408576698