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

Unified Diff: chrome/test/data/webui/md_bookmarks/test_util.js

Issue 2820153003: [MD Bookmarks] Add keyboard navigation to sidebar. (Closed)
Patch Set: address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/test_store.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/md_bookmarks/test_util.js
diff --git a/chrome/test/data/webui/md_bookmarks/test_util.js b/chrome/test/data/webui/md_bookmarks/test_util.js
index 090758749019d447ceb5c8d237dabe997b2fdeac..593610b359f50d3dbe59a69bafff36e1cd350d05 100644
--- a/chrome/test/data/webui/md_bookmarks/test_util.js
+++ b/chrome/test/data/webui/md_bookmarks/test_util.js
@@ -58,9 +58,8 @@ function createFolder(id, children, config) {
*/
function removeChild(tree, index) {
tree.children.splice(index, 1);
- for (var i = index; i < tree.children.length; i++) {
+ for (var i = index; i < tree.children.length; i++)
tree.children[i].index = i;
- }
}
/**
@@ -114,3 +113,22 @@ function customClick(element, config) {
element.dispatchEvent(new MouseEvent('mouseup', props));
element.dispatchEvent(new MouseEvent('click', props));
}
+
+/**
+ * Returns a folder node beneath |rootNode| which matches |id|.
+ * @param {BookmarksFolderNodeElement} rootNode
+ * @param {string} id
+ * @return {BookmarksFolderNodeElement}
+ */
+function findFolderNode(rootNode, id) {
+ var nodes = [rootNode];
+ var node;
+ while (nodes.length) {
+ node = nodes.pop();
+ if (node.itemId == id)
+ return node;
+
+ node.root.querySelectorAll('bookmarks-folder-node')
+ .forEach((x) => {nodes.unshift(x)});
+ }
+}
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/test_store.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698