diff --git a/README.md b/README.md index 60ae7df..786ffc8 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ A small Chrome extension that automatically clicks "Skip Intro" and "Skip Credit - Toggle Skip Intro and Skip Credits independently — both on by default. - Optional delay (0-30s) before each is clicked, in case a show needs a few extra seconds before the credits skip feels right. - Settings save instantly and apply live, no reload required for toggle or delay changes. +- The settings popup follows your browser/OS dark mode setting automatically. ## Install diff --git a/popup.html b/popup.html index 66afedd..70aca91 100644 --- a/popup.html +++ b/popup.html @@ -3,31 +3,58 @@ diff --git a/popup.js b/popup.js index c36c521..7ce86e3 100644 --- a/popup.js +++ b/popup.js @@ -55,9 +55,10 @@ document.addEventListener("DOMContentLoaded", () => { function showStatus(message, isError) { status.textContent = message; - status.style.color = isError ? "#c0392b" : "#2a8f2a"; + status.classList.toggle("error", !!isError); setTimeout(() => { status.textContent = ""; + status.classList.remove("error"); }, 1500); } diff --git a/tests/popup.test.js b/tests/popup.test.js index e16608c..003d6ca 100644 --- a/tests/popup.test.js +++ b/tests/popup.test.js @@ -121,6 +121,31 @@ test("saving an unparseable custom URL is rejected with an error, not saved", as assert.strictEqual(savedCalls.length, 0, "should not save an invalid URL"); }); +test("marks the status message as an error (for themed error styling) on a rejected save", 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(20); + + assert.strictEqual(window.document.getElementById("status").classList.contains("error"), true); +}); + +test("does not mark the status message as an error on a successful save", async () => { + const { window } = loadPopupScript(); + await wait(20); + + window.document.getElementById("saveBtn").click(); + await wait(20); + + assert.strictEqual(window.document.getElementById("status").classList.contains("error"), false); +}); + test("unchecking a toggle and saving persists it as false", async () => { const { window, savedCalls } = loadPopupScript(); await wait(20);