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

Side by Side Diff: chrome/test/data/webui/md_bookmarks/test_store.js

Issue 2858483002: MD Bookmarks: Update a couple of TODOs (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 suiteSetup(function() { 5 suiteSetup(function() {
6 cr.define('bookmarks', function() { 6 cr.define('bookmarks', function() {
7 var TestStore = function(data) { 7 var TestStore = function(data) {
8 bookmarks.Store.call(this); 8 bookmarks.Store.call(this);
9 this.data_ = Object.assign(bookmarks.util.createEmptyState(), data); 9 this.data_ = Object.assign(bookmarks.util.createEmptyState(), data);
10 this.initialized_ = true; 10 this.initialized_ = true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 setReducersEnabled: function(enabled) { 45 setReducersEnabled: function(enabled) {
46 this.enableReducers_ = enabled; 46 this.enableReducers_ = enabled;
47 }, 47 },
48 48
49 reduce_: function(action) { 49 reduce_: function(action) {
50 this.lastAction_ = action; 50 this.lastAction_ = action;
51 if (this.enableReducers_) 51 if (this.enableReducers_)
52 bookmarks.Store.prototype.reduce_.call(this, action); 52 bookmarks.Store.prototype.reduce_.call(this, action);
53 }, 53 },
54 54
55 /**
56 * Notifies UI elements that the store data has changed. When reducers are
57 * disabled, tests are responsible for manually changing the data to make
58 * UI elements update correctly (eg, tests must replace the whole list
59 * when changing a single element).
tsergeant 2017/05/02 05:09:10 It's been long enough to convince me that we don't
calamity 2017/05/02 05:35:59 Agreed. I don't foresee any other major data membe
60 */
55 notifyObservers: function() { 61 notifyObservers: function() {
56 // TODO(tsergeant): Revisit how state modifications work in UI tests.
57 // We don't want tests to worry about modifying the whole state tree.
58 // Instead, we could perform a deep clone in here to ensure that every
59 // StoreClient is updated.
60 this.notifyObservers_(this.data); 62 this.notifyObservers_(this.data);
61 }, 63 },
62 64
63 // Call in order to accept data from an init call to the TestStore once. 65 // Call in order to accept data from an init call to the TestStore once.
64 acceptInitOnce: function() { 66 acceptInitOnce: function() {
65 this.acceptInit_ = true; 67 this.acceptInit_ = true;
66 this.initialized_ = false; 68 this.initialized_ = false;
67 }, 69 },
68 }; 70 };
69 71
70 return { 72 return {
71 TestStore: TestStore, 73 TestStore: TestStore,
72 }; 74 };
73 }); 75 });
74 }); 76 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698