Close popup automatically after a successful save

This commit is contained in:
Justin Oro
2026-09-02 16:53:22 -07:00
parent b2082d0624
commit 646a106e93
4 changed files with 39 additions and 1 deletions
+28
View File
@@ -133,3 +133,31 @@ test("unchecking a toggle and saving persists it as false", async () => {
assert.strictEqual(savedCalls[0].skipCredits, false);
assert.strictEqual(savedCalls[0].skipIntro, true);
});
test("closes the popup shortly after a successful save", async () => {
const { window } = loadPopupScript();
await wait(20);
window.document.getElementById("saveBtn").click();
await wait(50);
assert.strictEqual(window.__closeCalled, false, "should not close instantly, so the Saved message is visible");
await wait(700);
assert.strictEqual(window.__closeCalled, true, "should close shortly after saving");
});
test("does not close the popup when the save is rejected for a blank custom URL", async () => {
const { window } = loadPopupScript();
await wait(20);
const urlPreset = window.document.getElementById("urlPreset");
urlPreset.value = "custom";
urlPreset.dispatchEvent(new window.Event("change"));
window.document.getElementById("customUrl").value = " ";
window.document.getElementById("saveBtn").click();
await wait(700);
assert.strictEqual(window.__closeCalled, false);
});