// @vitest-environment node import { renderToStaticMarkup } from "react-dom/server"; import { describe, expect, it } from "vitest"; import { StatusIcon } from "./StatusIcon"; /** * StatusIcon renders the unified {@link StatusGlyph} (one shape per status) at * every standalone status surface. These tests lock the glyph rendering, the * covered-blocked → "in queue" mapping, the accessible blocked labels, and the * size prop. */ describe("StatusIcon", () => { it("renders the unified glyph (24-unit viewBox), not a bespoke ring", () => { const html = renderToStaticMarkup(); expect(html).toContain('viewBox="0 0 24 24"'); expect(html).not.toContain("rounded-full border-2"); }); it("drives the glyph colour from the status icon var", () => { const html = renderToStaticMarkup(); expect(html).toContain("var(--status-task-icon-todo)"); }); it("maps covered-blocked → In queue (blue in_queue var, no cyan markers)", () => { const html = renderToStaticMarkup( , ); expect(html).toContain("var(--status-task-icon-in_queue)"); expect(html).not.toContain("bg-cyan"); expect(html).not.toContain("border-cyan"); // Full blocked reason still rides on the accessible label. expect(html).toContain("Blocked · waiting on active sub-task PAP-9"); }); it("surfaces attention-required blocked copy and keeps the blocked glyph", () => { const html = renderToStaticMarkup( , ); expect(html).toContain("Blocked · 3 blockers need attention; 2 covered by active work"); // needs_attention is not "covered", so it keeps the blocked glyph (not in_queue). expect(html).toContain("var(--status-task-icon-blocked)"); expect(html).not.toContain("var(--status-task-icon-in_queue)"); }); it("surfaces stalled-review blocked copy on the accessible label", () => { const html = renderToStaticMarkup( , ); expect(html).toContain("Blocked · review stalled on PAP-2279"); }); it("uses an accessible native button for the icon-only picker trigger", () => { const html = renderToStaticMarkup( {}} />); expect(html).toContain('viewBox="0 0 24 24"'); expect(html).toContain('