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

Unified Diff: chrome/test/data/webui/md_bookmarks/store_client_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
Index: chrome/test/data/webui/md_bookmarks/store_client_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/store_client_test.js b/chrome/test/data/webui/md_bookmarks/store_client_test.js
deleted file mode 100644
index 80bfa8494c909b690ed62db530bdf528995f5530..0000000000000000000000000000000000000000
--- a/chrome/test/data/webui/md_bookmarks/store_client_test.js
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-suite('bookmarks.StoreClient', function() {
- var store;
- var client;
-
- function update(newState) {
- store.notifyObservers_(newState);
- Polymer.dom.flush();
- }
-
- function getRenderedItems() {
- return Array.from(client.root.querySelectorAll('.item'))
- .map((div) => div.textContent.trim());
- }
-
- suiteSetup(function() {
- document.body.innerHTML = `
- <dom-module is="test-store-client">
- <template>
- <template is="dom-repeat" items="[[items]]">
- <div class="item">[[item]]</div>
- </template>
- </template>
- </dom-module>
- `;
-
- Polymer({
- is: 'test-store-client',
-
- behaviors: [bookmarks.StoreClient],
-
- properties: {
- items: {
- type: Array,
- observer: 'itemsChanged_',
- },
- },
-
- attached: function() {
- this.hasChanged = false;
- this.watch('items', function(state) {
- return state.items;
- });
- this.updateFromStore();
- },
-
- itemsChanged_: function(newItems, oldItems) {
- if (oldItems)
- this.hasChanged = true;
- },
- });
- });
-
- setup(function() {
- PolymerTest.clearBody();
-
- // Reset store instance:
- bookmarks.Store.instance_ = new bookmarks.Store();
- store = bookmarks.Store.getInstance();
- store.init({
- items: ['apple', 'banana', 'cantaloupe'],
- count: 3,
- });
-
- client = document.createElement('test-store-client');
- document.body.appendChild(client);
- Polymer.dom.flush();
- });
-
- test('renders initial data', function() {
- assertDeepEquals(['apple', 'banana', 'cantaloupe'], getRenderedItems());
- });
-
- test('renders changes to watched state', function() {
- var newItems = ['apple', 'banana', 'courgette', 'durian'];
- var newState = Object.assign({}, store.data, {
- items: newItems,
- });
- update(newState);
-
- assertTrue(client.hasChanged);
- assertDeepEquals(newItems, getRenderedItems());
- });
-
- test('ignores changes to other subtrees', function() {
- var newState = Object.assign({}, store.data, {count: 2});
- update(newState);
-
- assertFalse(client.hasChanged);
- });
-});
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/md_bookmarks_browsertest.js ('k') | chrome/test/data/webui/md_bookmarks/store_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698