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

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

Issue 2820153003: [MD Bookmarks] Add keyboard navigation to sidebar. (Closed)
Patch Set: Created 3 years, 8 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 /** 5 /**
6 * Replace the current body of the test with a new element. 6 * Replace the current body of the test with a new element.
7 * @param {Element} element 7 * @param {Element} element
8 */ 8 */
9 function replaceBody(element) { 9 function replaceBody(element) {
10 PolymerTest.clearBody(); 10 PolymerTest.clearBody();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 if (config) { 108 if (config) {
109 for (var key in config) 109 for (var key in config)
110 props[key] = config[key]; 110 props[key] = config[key];
111 } 111 }
112 112
113 element.dispatchEvent(new MouseEvent('mousedown', props)); 113 element.dispatchEvent(new MouseEvent('mousedown', props));
114 element.dispatchEvent(new MouseEvent('mouseup', props)); 114 element.dispatchEvent(new MouseEvent('mouseup', props));
115 element.dispatchEvent(new MouseEvent('click', props)); 115 element.dispatchEvent(new MouseEvent('click', props));
116 } 116 }
117
118 /**
119 * Returns a folder node beneath |rootNode| which matches |id|.
120 * @param {BookmarksFolderNodeElement} rootNode
121 * @param {string} id
122 * @return {BookmarksFolderNodeElement}
123 */
124 function findFolderNode(rootNode, id) {
125 var nodes = [rootNode];
126 var node;
127 while (nodes.length) {
128 node = nodes.pop();
129 if (node.itemId == id)
130 return node;
131
132 node.root.querySelectorAll('bookmarks-folder-node')
133 .forEach((x) => {nodes.unshift(x)});
134 }
135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698