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

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

Issue 2869273011: [MD Bookmarks] Convert bookmark list to iron-list. (Closed)
Patch Set: add comment, fix closure, rebase 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
« no previous file with comments | « chrome/browser/resources/md_bookmarks/types.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 suite('<bookmarks-list>', function() { 5 suite('<bookmarks-list>', function() {
6 var list; 6 var list;
7 var store; 7 var store;
8 8
9 setup(function() { 9 setup(function() {
10 store = new bookmarks.TestStore({ 10 store = new bookmarks.TestStore({
11 nodes: testTree(createFolder( 11 nodes: testTree(createFolder(
12 '0', 12 '0',
13 [ 13 [
14 createItem('1'), 14 createItem('1'),
15 createFolder('3', []), 15 createFolder('3', []),
16 createItem('5'), 16 createItem('5'),
17 createItem('7'), 17 createItem('7'),
18 ])), 18 ])),
19 selectedFolder: '0', 19 selectedFolder: '0',
20 }); 20 });
21 bookmarks.Store.instance_ = store; 21 bookmarks.Store.instance_ = store;
22 22
23 list = document.createElement('bookmarks-list'); 23 list = document.createElement('bookmarks-list');
24 list.style.height = '100%';
25 list.style.width = '100%';
26 list.style.position= 'absolute';
27
24 replaceBody(list); 28 replaceBody(list);
25 Polymer.dom.flush(); 29 Polymer.dom.flush();
26 }); 30 });
27 31
28 test('renders correct <bookmark-item> elements', function() { 32 test('renders correct <bookmark-item> elements', function() {
29 var items = list.root.querySelectorAll('bookmarks-item'); 33 var items = list.root.querySelectorAll('bookmarks-item');
30 var ids = Array.from(items).map((item) => item.itemId); 34 var ids = Array.from(items).map((item) => item.itemId);
31 35
32 assertDeepEquals(['1', '3', '5', '7'], ids); 36 assertDeepEquals(['1', '3', '5', '7'], ids);
33 }); 37 });
(...skipping 14 matching lines...) Expand all
48 assertEquals('select-items', store.lastAction.name); 52 assertEquals('select-items', store.lastAction.name);
49 assertTrue(store.lastAction.add); 53 assertTrue(store.lastAction.add);
50 assertEquals('5', store.lastAction.anchor); 54 assertEquals('5', store.lastAction.anchor);
51 assertDeepEquals(['1', '3', '5'], store.lastAction.items); 55 assertDeepEquals(['1', '3', '5'], store.lastAction.items);
52 }); 56 });
53 57
54 test('deselects items on click outside of card', function() { 58 test('deselects items on click outside of card', function() {
55 customClick(list); 59 customClick(list);
56 assertEquals('deselect-items', store.lastAction.name); 60 assertEquals('deselect-items', store.lastAction.name);
57 }); 61 });
62
63 test('adds, deletes, and moves update displayedList_', function() {
64 list.displayedIds_ = ['1', '7', '3', '5'];
65 assertDeepEquals(list.displayedIds_, list.displayedList_.map(n => n.id));
66
67 list.displayedIds_ = ['1', '3', '5'];
68 assertDeepEquals(list.displayedIds_, list.displayedList_.map(n => n.id));
69
70 list.displayedIds_ = ['1', '3', '7', '5'];
71 assertDeepEquals(list.displayedIds_, list.displayedList_.map(n => n.id));
72 });
58 }); 73 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/types.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698