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

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

Issue 2946203002: MD Bookmarks: Batch updates to the UI when processing deletes and moves (Closed)
Patch Set: Batch in API listener Created 3 years, 6 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/test/data/webui/md_bookmarks/store_client_test.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/store_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/store_client_test.js b/chrome/test/data/webui/md_bookmarks/store_test.js
similarity index 70%
rename from chrome/test/data/webui/md_bookmarks/store_client_test.js
rename to chrome/test/data/webui/md_bookmarks/store_test.js
index 80bfa8494c909b690ed62db530bdf528995f5530..e342c0e31dc3643f9d62c19f9d8fc41cf04c63d1 100644
--- a/chrome/test/data/webui/md_bookmarks/store_client_test.js
+++ b/chrome/test/data/webui/md_bookmarks/store_test.js
@@ -2,6 +2,46 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+suite('bookmarks.Store', function() {
+ var store;
+
+ setup(function() {
+ store = new bookmarks.TestStore({
+ nodes: testTree(createFolder(
+ '1',
+ [
+ createItem('11'),
+ createItem('12'),
+ createItem('13'),
+ ])),
+ });
+ store.setReducersEnabled(true);
+ store.replaceSingleton();
+ });
+
+ test('batch mode disables updates', function() {
+ var lastStateChange = null;
+ var observer = {
+ onStateChanged: function(state) {
+ lastStateChange = state;
+ },
+ };
+
+ store.addObserver(observer);
+ store.beginBatchUpdate();
+
+ store.dispatch(
+ bookmarks.actions.removeBookmark('11', '1', 0, store.data.nodes));
+ assertEquals(null, lastStateChange);
+ store.dispatch(
+ bookmarks.actions.removeBookmark('12', '1', 0, store.data.nodes));
+ assertEquals(null, lastStateChange);
+
+ store.endBatchUpdate();
+ assertDeepEquals(['13'], lastStateChange.nodes['1'].children);
+ });
+});
+
suite('bookmarks.StoreClient', function() {
var store;
var client;
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/store_client_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698