diff --git a/src/static/tests/SigSelectSpec.js b/src/static/tests/SigSelectSpec.js index a467eaa..2e6d519 100644 --- a/src/static/tests/SigSelectSpec.js +++ b/src/static/tests/SigSelectSpec.js @@ -919,6 +919,25 @@ describe("SigSelect", () => { takeSigBtn = document.getElementById("id_take_sig_btn"); expect(takeSigBtn.textContent).toBe("WAIT NVM"); }); + + it("re-renders the numeral when countdown_start arrives again after a cancel", () => { + // Diagnostic for the re-ready bug: cancel → re-ready must restart the + // visual countdown. This exercises the CLIENT handler chain only; if + // it passes, the live failure is WS delivery (socket / broadcast), not + // client logic. + makeFixture({ reservations: '{"42":"PC"}', ready: true, countdownRemaining: 9 }); + takeSigBtn = document.getElementById("id_take_sig_btn"); + expect(takeSigBtn.textContent).toBe("9"); // counting + window.dispatchEvent(new CustomEvent("room:countdown_cancel", { + detail: { polarity: "levity", seconds_remaining: 7 }, + })); + expect(takeSigBtn.textContent).toBe("WAIT NVM"); // cancelled + window.dispatchEvent(new CustomEvent("room:countdown_start", { + detail: { polarity: "levity", seconds: 7 }, + })); + expect(takeSigBtn.textContent).toBe("7"); // restarted + expect(takeSigBtn.classList.contains("sig-take-sig-btn--counting")).toBe(true); + }); }); // ── polarity_room_done → tray sequence ─────────────────────────────────── // diff --git a/src/static_src/tests/SigSelectSpec.js b/src/static_src/tests/SigSelectSpec.js index a467eaa..2e6d519 100644 --- a/src/static_src/tests/SigSelectSpec.js +++ b/src/static_src/tests/SigSelectSpec.js @@ -919,6 +919,25 @@ describe("SigSelect", () => { takeSigBtn = document.getElementById("id_take_sig_btn"); expect(takeSigBtn.textContent).toBe("WAIT NVM"); }); + + it("re-renders the numeral when countdown_start arrives again after a cancel", () => { + // Diagnostic for the re-ready bug: cancel → re-ready must restart the + // visual countdown. This exercises the CLIENT handler chain only; if + // it passes, the live failure is WS delivery (socket / broadcast), not + // client logic. + makeFixture({ reservations: '{"42":"PC"}', ready: true, countdownRemaining: 9 }); + takeSigBtn = document.getElementById("id_take_sig_btn"); + expect(takeSigBtn.textContent).toBe("9"); // counting + window.dispatchEvent(new CustomEvent("room:countdown_cancel", { + detail: { polarity: "levity", seconds_remaining: 7 }, + })); + expect(takeSigBtn.textContent).toBe("WAIT NVM"); // cancelled + window.dispatchEvent(new CustomEvent("room:countdown_start", { + detail: { polarity: "levity", seconds: 7 }, + })); + expect(takeSigBtn.textContent).toBe("7"); // restarted + expect(takeSigBtn.classList.contains("sig-take-sig-btn--counting")).toBe(true); + }); }); // ── polarity_room_done → tray sequence ─────────────────────────────────── //