| 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(); |
| 11 document.body.appendChild(element); | 11 document.body.appendChild(element); |
| 12 } | 12 } |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Convert a tree of bookmark nodes into a normalized lookup table of nodes. | 15 * Convert a list of top-level bookmark nodes into a normalized lookup table of |
| 16 * nodes. |
| 17 * @param {...BookmarkTreeNode} nodes |
| 16 */ | 18 */ |
| 17 function testTree(root) { | 19 function testTree(nodes) { |
| 18 return bookmarks.util.normalizeNodes(root); | 20 return bookmarks.util.normalizeNodes( |
| 21 createFolder('0', Array.from(arguments))); |
| 19 } | 22 } |
| 20 | 23 |
| 21 /** | 24 /** |
| 22 * Creates a folder with given properties. | 25 * Creates a folder with given properties. |
| 23 * @param {string} id | 26 * @param {string} id |
| 24 * @param {Array<BookmarkTreeNode>} children | 27 * @param {Array<BookmarkTreeNode>} children |
| 25 * @param {Object=} config | 28 * @param {Object=} config |
| 26 * @return {BookmarkTreeNode} | 29 * @return {BookmarkTreeNode} |
| 27 */ | 30 */ |
| 28 function createFolder(id, children, config) { | 31 function createFolder(id, children, config) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 95 |
| 93 if (config) { | 96 if (config) { |
| 94 for (var key in config) | 97 for (var key in config) |
| 95 props[key] = config[key]; | 98 props[key] = config[key]; |
| 96 } | 99 } |
| 97 | 100 |
| 98 element.dispatchEvent(new MouseEvent('mousedown', props)); | 101 element.dispatchEvent(new MouseEvent('mousedown', props)); |
| 99 element.dispatchEvent(new MouseEvent('mouseup', props)); | 102 element.dispatchEvent(new MouseEvent('mouseup', props)); |
| 100 element.dispatchEvent(new MouseEvent('click', props)); | 103 element.dispatchEvent(new MouseEvent('click', props)); |
| 101 } | 104 } |
| OLD | NEW |