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

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

Issue 2639453002: [MD Bookmarks] Add Select for Bookmarks. (Closed)
Patch Set: fixed some comments Created 3 years, 10 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/store_test.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 64755a2f3ce1fea25e9bf214a2f6f3a405a74ad3..837841e299809e80939d84538e32b7b5f400dd2e 100644
--- a/chrome/test/data/webui/md_bookmarks/test_util.js
+++ b/chrome/test/data/webui/md_bookmarks/test_util.js
@@ -52,6 +52,19 @@ function createFolder(id, children, config) {
}
/**
+ * Splices out the item/folder at |index| and adjusts the indices of all the
+ * items after that.
+ * @param {BookmarkTreeNode} tree
+ * @param {Number} index
+ */
+function removeChild(tree, index) {
+ tree.children.splice(index, 1);
+ for (var i = index; i < tree.children.length; i++) {
+ tree.children[i].index = i;
+ }
+}
+
+/**
* Creates a bookmark with given properties.
* @param {string} id
* @param {Object=} config
@@ -69,3 +82,27 @@ function createItem(id, config) {
}
return newItem;
}
+
+/**
+ * Sends a custom click event to |element|.
+ * @param {HTMLElement} element
+ * @param {Object=} config
+ */
+function customClick(element, config) {
+ var props = {
+ bubbles: true,
+ cancelable: true,
+ buttons: 1,
+ shiftKey: false,
+ ctrlKey: false,
+ };
+
+ if (config) {
+ for (var key in config)
+ props[key] = config[key];
+ }
+
+ element.dispatchEvent(new MouseEvent('mousedown', props));
+ element.dispatchEvent(new MouseEvent('mouseup', props));
+ element.dispatchEvent(new MouseEvent('click', props));
+}
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/store_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698