feat: prime presentation demo routes
This commit is contained in:
@@ -231,4 +231,21 @@ describe("PresentationRoute", () => {
|
||||
expect(window.location.hash).toBe("#scene/interrupt-evidence/approval");
|
||||
expect(screen.queryByLabelText("workflow.runs.resume operation")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("opens approval with enabled approval controls immediately after priming", async () => {
|
||||
window.location.hash = "#scene/interrupt-evidence/approval";
|
||||
const { PresentationRoute } = await import("./PresentationRoute.js");
|
||||
render(<PresentationRoute />);
|
||||
|
||||
expect(await screen.findByRole("button", { name: "Submit" })).toBeEnabled();
|
||||
expect(screen.getByRole("button", { name: "Cancel" })).toBeEnabled();
|
||||
});
|
||||
|
||||
it("opens resume with resume operation proof immediately after priming", async () => {
|
||||
window.location.hash = "#scene/interrupt-evidence/resume";
|
||||
const { PresentationRoute } = await import("./PresentationRoute.js");
|
||||
render(<PresentationRoute />);
|
||||
|
||||
expect(await screen.findByLabelText("workflow.runs.resume operation")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import { loadCanonicalDemoRecording } from "../demo/timeline/replay.js";
|
||||
import { useDemoTimeline } from "../demo/useDemoTimeline.js";
|
||||
import { PresentationCanvas } from "./PresentationCanvas.js";
|
||||
import { PresentationStage } from "./PresentationStage.js";
|
||||
import { requirementForDemoBeat } from "./demo-beat-requirements.js";
|
||||
import {
|
||||
createInitialPresentationState,
|
||||
presentationReducer,
|
||||
@@ -105,6 +106,17 @@ export const PresentationRoute = () => {
|
||||
}
|
||||
}, [demo.state.phase, demo.state.mode, demo.start]);
|
||||
|
||||
useEffect(() => {
|
||||
if (state.location.kind !== "main") return;
|
||||
if (demo.state.mode !== "replay") return;
|
||||
|
||||
const requirement = requirementForDemoBeat(
|
||||
state.location.sceneId,
|
||||
state.location.beatId,
|
||||
);
|
||||
demo.primeReplayToStage(requirement.requiredStage);
|
||||
}, [demo.state.mode, demo.primeReplayToStage, state.location]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch({ type: "set_playback_mode", mode: demo.state.mode });
|
||||
}, [demo.state.mode]);
|
||||
|
||||
Reference in New Issue
Block a user