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

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

Issue 2733463002: MD Bookmarks: Add basic page features to new data-flow system (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
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.
16 */
17 function testTree(root) {
18 return bookmarks.util.normalizeNodes(root);
19 }
20
21 /**
15 * Initialize a tree for UI testing. This performs the same initialization as 22 * Initialize a tree for UI testing. This performs the same initialization as
16 * `setUpStore_` in <bookmarks-store>, but without the need for a store element 23 * `setUpStore_` in <bookmarks-store>, but without the need for a store element
17 * in the test. 24 * in the test.
18 * @param {BookmarkTreeNode} rootNode 25 * @param {BookmarkTreeNode} rootNode
19 */ 26 */
20 function setupTreeForUITests(rootNode){ 27 function setupTreeForUITests(rootNode){
21 if (!rootNode.path) 28 if (!rootNode.path)
22 rootNode.path = 'rootNode'; 29 rootNode.path = 'rootNode';
23 30
24 BookmarksStore.generatePaths(rootNode, 0); 31 BookmarksStore.generatePaths(rootNode, 0);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 106
100 if (config) { 107 if (config) {
101 for (var key in config) 108 for (var key in config)
102 props[key] = config[key]; 109 props[key] = config[key];
103 } 110 }
104 111
105 element.dispatchEvent(new MouseEvent('mousedown', props)); 112 element.dispatchEvent(new MouseEvent('mousedown', props));
106 element.dispatchEvent(new MouseEvent('mouseup', props)); 113 element.dispatchEvent(new MouseEvent('mouseup', props));
107 element.dispatchEvent(new MouseEvent('click', props)); 114 element.dispatchEvent(new MouseEvent('click', props));
108 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698