Add configurable skip delay (0-30s) for Skip Intro and Skip Credits

This commit is contained in:
Justin Oro
2026-09-02 16:50:04 -07:00
parent 0f1f2a309e
commit b2082d0624
9 changed files with 333 additions and 21 deletions
+42 -1
View File
@@ -2,7 +2,7 @@ const test = require("node:test");
const assert = require("node:assert");
const { loadPopupScript, wait } = require("./helpers");
test("defaults to app.plex.tv preset with both toggles on", async () => {
test("defaults to app.plex.tv preset with both toggles on and delays at 0s", async () => {
const { window } = loadPopupScript();
await wait(20);
@@ -10,6 +10,47 @@ test("defaults to app.plex.tv preset with both toggles on", async () => {
assert.strictEqual(window.document.getElementById("skipIntro").checked, true);
assert.strictEqual(window.document.getElementById("skipCredits").checked, true);
assert.strictEqual(window.document.getElementById("customUrlRow").style.display, "none");
assert.strictEqual(window.document.getElementById("introDelay").value, "0");
assert.strictEqual(window.document.getElementById("creditsDelay").value, "0");
assert.strictEqual(window.document.getElementById("introDelayValue").textContent, "0s");
assert.strictEqual(window.document.getElementById("creditsDelayValue").textContent, "0s");
});
test("loads a previously saved delay value onto the sliders", async () => {
const { window } = loadPopupScript({
initialSettings: { introDelaySeconds: 3, creditsDelaySeconds: 12 }
});
await wait(20);
assert.strictEqual(window.document.getElementById("introDelay").value, "3");
assert.strictEqual(window.document.getElementById("introDelayValue").textContent, "3s");
assert.strictEqual(window.document.getElementById("creditsDelay").value, "12");
assert.strictEqual(window.document.getElementById("creditsDelayValue").textContent, "12s");
});
test("disables a delay slider when its skip toggle is off", async () => {
const { window } = loadPopupScript({
initialSettings: { skipCredits: false }
});
await wait(20);
assert.strictEqual(window.document.getElementById("introDelay").disabled, false);
assert.strictEqual(window.document.getElementById("creditsDelay").disabled, true);
});
test("saving persists the configured delay values", async () => {
const { window, savedCalls } = loadPopupScript();
await wait(20);
window.document.getElementById("introDelay").value = "5";
window.document.getElementById("creditsDelay").value = "20";
window.document.getElementById("saveBtn").click();
await wait(20);
assert.strictEqual(savedCalls.length, 1);
assert.strictEqual(savedCalls[0].introDelaySeconds, 5);
assert.strictEqual(savedCalls[0].creditsDelaySeconds, 20);
});
test("shows custom URL field pre-filled when a custom URL is already saved", async () => {