diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-02 17:52:34 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-02 17:52:34 +0100 |
commit | 166fb9f2893dcfb3375aa3227d116fb0ce2c6d42 (patch) | |
tree | 9bfd8bb159a20f00ff507ab9c27c22434155df23 /devtools/client/storage/test/head.js | |
parent | 26e53627d6922b3b965afd76fc5d72e3cc1d9ba5 (diff) | |
download | UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.gz UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.lz UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.xz UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.zip |
moebius#339: Make it possible to add cookies, local and session storage entries
Issue #31
https://github.com/MoonchildProductions/moebius/pull/339
Diffstat (limited to 'devtools/client/storage/test/head.js')
-rw-r--r-- | devtools/client/storage/test/head.js | 36 |
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.`); +} |