Fix six GUI defects, verified live against the real stack: - NavSessions: mark the in-progress (active) session in yellow (warning token) — both its status dot and its row background. - SteerInput: the composer is now an auto-growing textarea that wraps and grows vertically (caps at 160px, then scrolls); Enter sends, Shift+Enter inserts a newline. - WorkflowBar: show a synthetic title of the current phase under the 8 dots from static EN/IT strings (no LLM); English is displayed to match the chrome. - CentralStatus: reformat the 5-line system-message tail as a structured, monospace list with per-line markers and an emphasized last line. - AppShell + CentralStatus: move the left Model-activity panel toggle off the working spinner (now a pure status indicator) onto a dedicated arrow button (→ opens, ← closes). - gate: rename the phase-confirm button "Conferma e prosegui" → "Salva e procedi" (builders.js + its L1 test). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
2.1 KiB
TypeScript
44 lines
2.1 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { beforeEach } from "vitest";
|
|
import { useSessionStore } from "../store/sessionStore";
|
|
import { CentralStatus } from "./CentralStatus";
|
|
|
|
beforeEach(() => useSessionStore.getState().resetSession());
|
|
|
|
test("the working spinner is a pure status indicator (no activity toggle on it)", () => {
|
|
useSessionStore.getState().applyEvent({ type: "text_delta", text: "reading the schema" });
|
|
render(<CentralStatus working />);
|
|
// The spinner no longer opens the panel — that moved to the header arrow toggle.
|
|
expect(screen.queryByRole("button", { name: /model activity/i })).not.toBeInTheDocument();
|
|
expect(screen.getByRole("status")).toBeInTheDocument();
|
|
});
|
|
|
|
test("renders nothing when not working and there is no user entry or step messages", () => {
|
|
const { container } = render(<CentralStatus working={false} />);
|
|
expect(container).toBeEmptyDOMElement();
|
|
});
|
|
|
|
test("echoes the last user entry and the step messages", () => {
|
|
const st = useSessionStore.getState();
|
|
st.setLastUserEntry({ kind: "input", text: "how many patients?" });
|
|
st.applyEvent({ type: "info", level: "info", text: "Searching the schema…" });
|
|
render(<CentralStatus working={false} />);
|
|
expect(screen.getByText("how many patients?")).toBeInTheDocument();
|
|
expect(screen.getByText("Searching the schema…")).toBeInTheDocument();
|
|
});
|
|
|
|
test("shows a working indicator with elapsed time and the model-stream tail while working", () => {
|
|
useSessionStore.getState().applyEvent({ type: "text_delta", text: "Reading the schema for dim_patient" });
|
|
render(<CentralStatus working />);
|
|
// elapsed time (e.g. "0s")
|
|
expect(screen.getByText(/\d+s/)).toBeInTheDocument();
|
|
// a short tail of the model's current output
|
|
expect(screen.getByText(/Reading the schema for dim_patient/)).toBeInTheDocument();
|
|
});
|
|
|
|
test("no working indicator when not working, even with a transcript", () => {
|
|
useSessionStore.getState().applyEvent({ type: "text_delta", text: "background narration" });
|
|
render(<CentralStatus working={false} />);
|
|
expect(screen.queryByText(/\d+s/)).not.toBeInTheDocument();
|
|
});
|