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

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

Issue 2645273002: [MD Bookmarks] Modify search to retain the previously selected folder. (Closed)
Patch Set: Rebase and update test to use selectFolder. 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 unified diff | Download patch
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-sidebar>', function() { 5 suite('<bookmarks-sidebar>', function() {
6 var sidebar; 6 var sidebar;
7 var TEST_TREE; 7 var TEST_TREE;
8 8
9 setup(function() { 9 setup(function() {
10 TEST_TREE = createFolder('0', [ 10 TEST_TREE = createFolder('0', [
(...skipping 13 matching lines...) Expand all
24 createFolder('8', []), 24 createFolder('8', []),
25 ]); 25 ]);
26 26
27 setupTreeForUITests(TEST_TREE); 27 setupTreeForUITests(TEST_TREE);
28 sidebar = document.createElement('bookmarks-sidebar'); 28 sidebar = document.createElement('bookmarks-sidebar');
29 replaceBody(sidebar); 29 replaceBody(sidebar);
30 sidebar.rootFolders = TEST_TREE.children; 30 sidebar.rootFolders = TEST_TREE.children;
31 }); 31 });
32 32
33 test('selecting and deselecting folders fires event', function() { 33 test('selecting and deselecting folders fires event', function() {
34 var firedId; 34 var firedId, clearSearch;
35 document.addEventListener('selected-folder-changed', function(e) { 35 document.addEventListener('selected-folder-changed', function(e) {
36 firedId = /** @type {string} */ (e.detail); 36 firedId = /** @type {string} */ (e.detail.id);
37 clearSearch = /** @type {string} */ (e.detail.clearSearch);
37 }); 38 });
38 39
39 Polymer.dom.flush(); 40 Polymer.dom.flush();
40 var rootFolders = sidebar.$['folder-tree'].children; 41 var rootFolders = sidebar.$['folder-tree'].children;
41 var firstGen = rootFolders[0].$['descendants'].querySelectorAll( 42 var firstGen = rootFolders[0].$['descendants'].querySelectorAll(
42 'bookmarks-folder-node'); 43 'bookmarks-folder-node');
43 var secondGen = 44 var secondGen =
44 firstGen[0].$['descendants'].querySelectorAll('bookmarks-folder-node'); 45 firstGen[0].$['descendants'].querySelectorAll('bookmarks-folder-node');
45 46
46 // Select nested folder. 47 // Select nested folder.
47 firedId = ''; 48 firedId = '';
48 MockInteractions.tap(secondGen[0].$['folder-label']); 49 MockInteractions.tap(secondGen[0].$['folder-label']);
49 assertEquals(secondGen[0].item.id, firedId); 50 assertEquals(secondGen[0].item.id, firedId);
51 assertTrue(clearSearch);
50 52
51 // Select folder in a separate subtree. 53 // Select folder in a separate subtree.
52 firedId = ''; 54 firedId = '';
53 MockInteractions.tap(rootFolders[1].$['folder-label']); 55 MockInteractions.tap(rootFolders[1].$['folder-label']);
54 assertEquals(rootFolders[1].item.id, firedId); 56 assertEquals(rootFolders[1].item.id, firedId);
55 }); 57 });
56 }); 58 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/store.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