commit 185e537670969351a05b61e4ae63e78004e346af
parent aa2f79eb7c38ba5ca83810d779ec6dd8d4b56ded
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 9 Nov 2026 14:30:36 -0500
umtool: the intro editor's version boxes show the press at once; the spec polls the take file
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/umtool/components/projects/report/IntroEditor.tsx b/umtool/components/projects/report/IntroEditor.tsx
@@ -225,9 +225,12 @@ function IntroEditor({ project, state, reload }: { project: string; state: State
setDraft(draftOf((next ?? state).intro, c.styleDefault));
setSaid(null);
};
+ // A version's box shows the press at once; the reload after the write says what it is.
+ const [pressed, setPressed] = useState<Record<string, boolean>>({});
const setVersion = async (take: string, on: boolean) => {
setBusy(true);
setSaid(null);
+ setPressed((p) => ({ ...p, [take]: on }));
try {
const r = await fetch("/api/report/chrome/intro", {
method: "PUT",
@@ -238,6 +241,10 @@ function IntroEditor({ project, state, reload }: { project: string; state: State
if (!r.ok) setSaid({ ok: false, text: String(j.error ?? `HTTP ${r.status}`) });
await reload();
} finally {
+ setPressed((p) => {
+ const { [take]: _done, ...rest } = p;
+ return rest;
+ });
setBusy(false);
}
};
@@ -344,7 +351,7 @@ function IntroEditor({ project, state, reload }: { project: string; state: State
<input
type="checkbox"
data-intro-version={v.id}
- checked={v.intro !== "off"}
+ checked={pressed[v.id] ?? v.intro !== "off"}
disabled={busy || (!savedHas && v.intro === "off") || v.intro === "own"}
onChange={(e) => void setVersion(v.id, e.target.checked)}
/>
diff --git a/umtool/e2e/fixtures/intro-play-fixture.mjs b/umtool/e2e/fixtures/intro-play-fixture.mjs
@@ -33,7 +33,11 @@ export function toneWav(seconds, rate = 8000) {
/** @param {{ reports: string, deckManifest: Function, cachedWindow: string, makePlayCutFixture: Function }} o */
export function makeIntroPlayFixture({ reports, deckManifest, cachedWindow, makePlayCutFixture }) {
- const { dir } = makePlayCutFixture({ reports, deckManifest, cachedWindow, name: "intro-play-fixture", title: "The Intro Play Fixture" });
+ // The tally's word fitted to its cell (play-teaser-fixture's): the deck composes, so Play shows the deck hiding over the intro.
+ const { dir } = makePlayCutFixture({
+ reports, deckManifest, cachedWindow, name: "intro-play-fixture", title: "The Intro Play Fixture",
+ chrome: { factcheck: { verdicts: { CORROBORATED: { label: "Seizures", tallyLabel: "Seized", color: "#6fa8dc" } }, stamp: { seconds: 1 } } },
+ });
const file = path.join(dir, "video.manifest.json");
const m = JSON.parse(readFileSync(file, "utf8"));
m.generatedOn = "2026-10-29";
diff --git a/umtool/e2e/intro-play.spec.ts b/umtool/e2e/intro-play.spec.ts
@@ -112,18 +112,20 @@ test("the Cut tab's intro row: Edit opens the knobs and a live preview; a new ti
await expect(editor.locator("[data-intro-save]")).toBeDisabled();
await editor.locator('[data-intro-field="seconds"]').fill("5");
await expect(editor.locator("[data-intro-problems]")).toHaveCount(0, { timeout: 20_000 });
- await shot(page, "intro-editor.png");
await editor.locator("[data-intro-save]").click();
await expect(editor.locator('[data-intro-said="ok"]')).toBeVisible();
expect(manifest().render.intro).toEqual({ style: "title-card", sound: "intro.wav", title: "A title of its own", seconds: 5 });
await expect(row.locator("[data-intro-summary]")).toContainText("A title of its own");
+ await expect(page.locator('[data-testid="intro-editor-preview"]')).toHaveAttribute("data-play-intro-ready", "1", { timeout: 30_000 });
+ await row.evaluate((el) => el.scrollIntoView({ block: "start" }));
+ await shot(page, "intro-editor.png");
// A version without the intro: its patch's render.intro is null; the project's manifest keeps it.
const v1 = editor.locator('[data-intro-version="v1"]');
await expect(v1).toBeChecked();
await v1.uncheck();
- await expect(v1).not.toBeChecked({ timeout: 10_000 });
- expect(takeDoc("v1").patch.render?.intro).toBeNull();
+ await expect.poll(() => takeDoc("v1").patch.render?.intro, { timeout: 10_000 }).toBeNull();
+ await expect(v1).not.toBeChecked();
expect((manifest().render.intro as { title?: string }).title).toBe("A title of its own");
await expect(row.locator("[data-intro-versions-off]")).toContainText("v1");
// Play on that version opens on c01: no intro.
@@ -134,6 +136,7 @@ test("the Cut tab's intro row: Edit opens the knobs and a live preview; a new ti
await page.goto(urls.projectHref(PROJECT, { tab: "cut" }));
await page.locator("[data-intro-edit]").click();
await page.locator('[data-intro-version="v1"]').check();
- await expect(page.locator('[data-intro-version="v1"]')).toBeChecked({ timeout: 10_000 });
- expect(takeDoc("v1").patch.render?.intro).toEqual(manifest().render.intro);
+ await expect.poll(() => JSON.stringify(takeDoc("v1").patch.render?.intro), { timeout: 10_000 }).toBe(JSON.stringify(manifest().render.intro));
+ await expect(page.locator('[data-intro-version="v1"]')).toBeChecked();
+ await expect(page.locator("[data-intro-versions-off]")).toHaveCount(0);
});