OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |