All tests work except the confirm page test
This commit is contained in:
parent
4920f478fb
commit
9002e3b3a2
3 changed files with 14 additions and 10 deletions
|
@ -534,7 +534,6 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||||
async initialize() {
|
async initialize() {
|
||||||
Utils.addEnterHandler(document.querySelector("#manage-containers-link"), (e) => {
|
Utils.addEnterHandler(document.querySelector("#manage-containers-link"), (e) => {
|
||||||
if (!e.target.classList.contains("disable-edit-containers")) {
|
if (!e.target.classList.contains("disable-edit-containers")) {
|
||||||
console.log("manage clicked")
|
|
||||||
Logic.showPanel(MANAGE_CONTAINERS_PICKER);
|
Logic.showPanel(MANAGE_CONTAINERS_PICKER);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -545,7 +544,6 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
|
||||||
Logic.showPanel(REOPEN_IN_CONTAINER_PICKER);
|
Logic.showPanel(REOPEN_IN_CONTAINER_PICKER);
|
||||||
});
|
});
|
||||||
Utils.addEnterHandler(document.querySelector("#always-open-in"), () => {
|
Utils.addEnterHandler(document.querySelector("#always-open-in"), () => {
|
||||||
console.log("clicked always-open-in");
|
|
||||||
Logic.showPanel(ALWAYS_OPEN_IN_PICKER);
|
Logic.showPanel(ALWAYS_OPEN_IN_PICKER);
|
||||||
});
|
});
|
||||||
Utils.addEnterHandler(document.querySelector("#info-icon"), () => {
|
Utils.addEnterHandler(document.querySelector("#info-icon"), () => {
|
||||||
|
@ -942,7 +940,6 @@ Logic.registerPanel(MANAGE_CONTAINERS_PICKER, {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Utils.addEnterHandler(document.querySelector("#new-container"), () => {
|
Utils.addEnterHandler(document.querySelector("#new-container"), () => {
|
||||||
console.log("new-container-clicked")
|
|
||||||
Logic.showPanel(P_CONTAINER_EDIT, { name: Logic.generateIdentityName() });
|
Logic.showPanel(P_CONTAINER_EDIT, { name: Logic.generateIdentityName() });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -966,7 +963,6 @@ Logic.registerPanel(MANAGE_CONTAINERS_PICKER, {
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
|
|
||||||
Utils.addEnterHandler(tr, () => {
|
Utils.addEnterHandler(tr, () => {
|
||||||
console.log("manage indentity:", identity)
|
|
||||||
pickedFunction(identity);
|
pickedFunction(identity);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -996,7 +992,6 @@ Logic.registerPanel(REOPEN_IN_CONTAINER_PICKER, {
|
||||||
document.getElementById("picker-title").textContent = "Reopen This Site in";
|
document.getElementById("picker-title").textContent = "Reopen This Site in";
|
||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
const currentTab = await Utils.currentTab();
|
const currentTab = await Utils.currentTab();
|
||||||
console.log("currentTab",currentTab);
|
|
||||||
const pickedFunction = function (identity) {
|
const pickedFunction = function (identity) {
|
||||||
const newUserContextId = Utils.userContextId(identity.cookieStoreId);
|
const newUserContextId = Utils.userContextId(identity.cookieStoreId);
|
||||||
Utils.reloadInContainer(
|
Utils.reloadInContainer(
|
||||||
|
@ -1112,7 +1107,6 @@ Logic.registerPanel(ALWAYS_OPEN_IN_PICKER, {
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
|
|
||||||
Utils.addEnterHandler(tr, () => {
|
Utils.addEnterHandler(tr, () => {
|
||||||
console.log("clicked");
|
|
||||||
Utils.alwaysOpenInContainer(identity);
|
Utils.alwaysOpenInContainer(identity);
|
||||||
window.close();
|
window.close();
|
||||||
});
|
});
|
||||||
|
@ -1310,7 +1304,6 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||||
|
|
||||||
const deleteButton = document.getElementById("delete-container-button");
|
const deleteButton = document.getElementById("delete-container-button");
|
||||||
Utils.addEnterHandler(deleteButton, () => {
|
Utils.addEnterHandler(deleteButton, () => {
|
||||||
console.log("delete button clicked")
|
|
||||||
Logic.showPanel(P_CONTAINER_DELETE, identity);
|
Logic.showPanel(P_CONTAINER_DELETE, identity);
|
||||||
});
|
});
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
|
@ -1333,7 +1326,6 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
|
||||||
Logic.showPreviousPanel();
|
Logic.showPreviousPanel();
|
||||||
});
|
});
|
||||||
Utils.addEnterHandler(document.querySelector("#delete-container-ok-link"), async () => {
|
Utils.addEnterHandler(document.querySelector("#delete-container-ok-link"), async () => {
|
||||||
console.log("delete ok clicked", Logic.currentIdentity().cookieStoreId)
|
|
||||||
/* This promise wont resolve if the last tab was removed from the window.
|
/* This promise wont resolve if the last tab was removed from the window.
|
||||||
as the message async callback stops listening, this isn't an issue for us however it might be in future
|
as the message async callback stops listening, this isn't an issue for us however it might be in future
|
||||||
if you want to do anything post delete do it in the background script.
|
if you want to do anything post delete do it in the background script.
|
||||||
|
|
|
@ -70,6 +70,13 @@ const buildPopupDom = popup => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const buildConfirmPage = async (url) => {
|
||||||
|
const webExtension = await webExtensionsJSDOM.fromFile(url);
|
||||||
|
|
||||||
|
webExtension.browser.runtime.onMessage = window.browser.runtime.sendMessage;
|
||||||
|
return webExtension;
|
||||||
|
};
|
||||||
|
|
||||||
const initializeWithTab = async (details = {
|
const initializeWithTab = async (details = {
|
||||||
cookieStoreId: "firefox-default"
|
cookieStoreId: "firefox-default"
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -108,4 +115,5 @@ module.exports = {
|
||||||
sinon,
|
sinon,
|
||||||
expect,
|
expect,
|
||||||
nextTick,
|
nextTick,
|
||||||
|
buildConfirmPage
|
||||||
};
|
};
|
|
@ -1,4 +1,5 @@
|
||||||
const {initializeWithTab} = require("../common");
|
const {initializeWithTab} = require("../common");
|
||||||
|
const {buildConfirmPage} = require("../common");
|
||||||
|
|
||||||
describe("Assignment Reopen Feature", function () {
|
describe("Assignment Reopen Feature", function () {
|
||||||
const url = "http://example.com";
|
const url = "http://example.com";
|
||||||
|
@ -88,8 +89,11 @@ describe("Assignment Comfirm Page Feature", function () {
|
||||||
describe("Set assignment to 'never ask' ", function () {
|
describe("Set assignment to 'never ask' ", function () {
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
// click confirm page to always open in container
|
// click confirm page to always open in container
|
||||||
await this.webExt.document.getElementById("never-ask").click();
|
const confirmPage = await buildConfirmPage("moz-extension://fake/confirm-page.html?" +
|
||||||
await this.webExt.document.getElementById("confirm").click();
|
`url=${encodeURIComponent(url)}` +
|
||||||
|
`&cookieStoreId=${this.webExt.tab.cookieStoreId}`);
|
||||||
|
await confirmPage.document.getElementById("never-ask").click();
|
||||||
|
await confirmPage.document.getElementById("confirm").click();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("open new Tab with url set to 'never ask' ", function () {
|
describe("open new Tab with url set to 'never ask' ", function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue