summaryrefslogtreecommitdiffstats
path: root/devtools/client/storage/test/head.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/storage/test/head.js')
-rw-r--r--devtools/client/storage/test/head.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js
index 07a66120e..ec6459b8d 100644
--- a/devtools/client/storage/test/head.js
+++ b/devtools/client/storage/test/head.js
@@ -897,3 +897,39 @@ function setPermission(url, permission) {
.addFromPrincipal(principal, permission,
nsIPermissionManager.ALLOW_ACTION);
}
+
+/**
+ * Add an item.
+ * @param {Array} store
+ * An array containing the path to the store to which we wish to add an
+ * item.
+ */
+function* performAdd(store) {
+ let storeName = store.join(" > ");
+ let toolbar = gPanelWindow.document.getElementById("storage-toolbar");
+ let type = store[0];
+
+ yield selectTreeItem(store);
+
+ let menuAdd = toolbar.querySelector(
+ "#add-button");
+
+ if (menuAdd.hidden) {
+ is(menuAdd.hidden, false,
+ `performAdd called for ${storeName} but it is not supported`);
+ return;
+ }
+
+ let eventEdit = gUI.table.once("row-edit");
+ let eventWait = gUI.once("store-objects-updated");
+
+ menuAdd.click();
+
+ let rowId = yield eventEdit;
+ yield eventWait;
+
+ let key = type === "cookies" ? "uniqueKey" : "name";
+ let value = getCellValue(rowId, key);
+
+ is(rowId, value, `Row '${rowId}' was successfully added.`);
+}