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

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

Issue 2735953002: MD Bookmarks: Integrate new data store with UI elements (Closed)
Patch Set: calamity@ review Created 3 years, 9 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
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/test_store.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
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 tree of bookmark nodes into a normalized lookup table of nodes.
16 */ 16 */
17 function testTree(root) { 17 function testTree(root) {
18 return bookmarks.util.normalizeNodes(root); 18 return bookmarks.util.normalizeNodes(root);
19 } 19 }
20 20
21 /** 21 /**
22 * Initialize a tree for UI testing. This performs the same initialization as
23 * `setUpStore_` in <bookmarks-store>, but without the need for a store element
24 * in the test.
25 * @param {BookmarkTreeNode} rootNode
26 */
27 function setupTreeForUITests(rootNode){
28 if (!rootNode.path)
29 rootNode.path = 'rootNode';
30
31 BookmarksStore.generatePaths(rootNode, 0);
32 BookmarksStore.initNodes(rootNode);
33 }
34
35 /**
36 * Creates a folder with given properties. 22 * Creates a folder with given properties.
37 * @param {string} id 23 * @param {string} id
38 * @param {Array<BookmarkTreeNode>} children 24 * @param {Array<BookmarkTreeNode>} children
39 * @param {Object=} config 25 * @param {Object=} config
40 * @return {BookmarkTreeNode} 26 * @return {BookmarkTreeNode}
41 */ 27 */
42 function createFolder(id, children, config) { 28 function createFolder(id, children, config) {
43 var newFolder = { 29 var newFolder = {
44 id: id, 30 id: id,
45 children: children, 31 children: children,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 92
107 if (config) { 93 if (config) {
108 for (var key in config) 94 for (var key in config)
109 props[key] = config[key]; 95 props[key] = config[key];
110 } 96 }
111 97
112 element.dispatchEvent(new MouseEvent('mousedown', props)); 98 element.dispatchEvent(new MouseEvent('mousedown', props));
113 element.dispatchEvent(new MouseEvent('mouseup', props)); 99 element.dispatchEvent(new MouseEvent('mouseup', props));
114 element.dispatchEvent(new MouseEvent('click', props)); 100 element.dispatchEvent(new MouseEvent('click', props));
115 } 101 }
OLDNEW
« 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