feat(learner): progress, toast and menu motion

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-30 20:53:34 +01:00
co-authored by Claude Opus 5.5
parent d5e836cc79
commit 370d381ff4
4 changed files with 44 additions and 5 deletions
+25
View File
@@ -224,4 +224,29 @@ run("navigation motion (headless Chrome)", () => {
await until(() => chrome.eval<boolean>(`document.querySelector(".stage canvas[data-front]").dataset.page === "3"`), "slide 3 drawn");
expect(await text(".deckbar .count")).toBe("3 / 3");
}, 30_000);
test("progress fills, the toast and the course menu answer with motion; Escape still closes at once", async () => {
await open("/c/sample/m1-intro", ".lr-main .lr-lesson h1.title");
const status = await chrome.eval<number>(`fetch("/api/auth/sign-up/email", { method: "POST", credentials: "same-origin", headers: { "content-type": "application/json" },
body: JSON.stringify({ email: "[email protected]", name: "Motion", password: "correct horse battery" }) }).then((r) => r.status)`);
expect(status).toBe(200);
await open("/c/sample/m1-intro", ".stc-dock button[aria-pressed]:not([disabled])");
await click(".stc-dock button[aria-pressed]");
await until(async () => (await m()).trans.includes("width@i"), "progress fill transition");
// The toast rises in, then fades out before it is removed.
await open("/c/sample/m2-ex-add", ".stc-seg button");
await chrome.eval(`[...document.querySelectorAll(".stc-seg button")].find((b) => b.textContent === "Reading").click(), true`);
await until(async () => (await m()).anims.includes("stc-enter@lr lr-toast"), "toast enter");
await until(async () => (await m()).anims.includes("stc-fade-out@lr lr-toast is-leaving"), "toast leave", 5000);
await until(async () => !(await exists(".lr-toast")), "toast removed", 2000);
// The course menu drops in; Escape closes it in the same task.
await reset();
await click(".lr-switch-btn");
await until(async () => (await m()).anims.includes("stc-drop@lr-menu"), "menu enter");
await chrome.send("Input.dispatchKeyEvent", { type: "keyDown", key: "Escape", code: "Escape", windowsVirtualKeyCode: 27 });
await chrome.send("Input.dispatchKeyEvent", { type: "keyUp", key: "Escape", code: "Escape", windowsVirtualKeyCode: 27 });
expect(await exists(".lr-menu")).toBe(false);
}, 40_000);
});