test(web): pin the dot matrix, the shared blink clock and markSeen
sessionDot had no test at all, which is how its priority order drifted away
from the plugin. session-dot.test.ts locks the whole matrix: the parent
order (exited > error > attention > done > busy > compacting > idle), every
collision that used to be wrong, the viewed -> current overlay, the separate
child matrix (steady red while viewed, never green, never attention) and the
subagent table.
blink.test.ts covers the one shared clock: phase lockstep, ref counting
(two subscribers, one interval), idempotent unsubscribe, and
prefers-reduced-motion pinning the dots solid.
chat.tree.test.tsx grows up from "a .dot exists" to the actual classes;
sessions-store.test.ts covers markSeen; components.test.tsx covers the dead
status and the steady/current modifiers.
Also makes the current-tab overlay a positive check (idle | busy |
compacting), matching the plugin markable list: a session that has not
reported a status yet ("starting") no longer claims the blue marker.
This commit is contained in:
1 parent
bf01fd549d
commit
c4d0057b0b
6 files changed
+965
-16
No files matched your search
@@ -60,11 +60,48 @@ describe("StatusDot", () => {
|
||||
["err", "dot--err"],
|
||||
["attention", "dot--attention"],
|
||||
["exited", "dot--exited"],
|
||||
["dead", "dot--dead"],
|
||||
] as const)("maps %s to %s", (status, expected) => {
|
||||
const { container } = render(<StatusDot status={status} />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", expected);
|
||||
});
|
||||
|
||||
it("applies dot--steady modifier when steady is true", () => {
|
||||
const { container } = render(<StatusDot status="err" steady={true} />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--err", "dot--steady");
|
||||
});
|
||||
|
||||
it("does not apply dot--steady when steady is false or omitted", () => {
|
||||
const { container: c1 } = render(<StatusDot status="err" steady={false} />);
|
||||
expect(c1.firstElementChild).not.toHaveClass("dot--steady");
|
||||
|
||||
const { container: c2 } = render(<StatusDot status="err" />);
|
||||
expect(c2.firstElementChild).not.toHaveClass("dot--steady");
|
||||
});
|
||||
|
||||
it("applies dot--current modifier when current is true", () => {
|
||||
const { container } = render(<StatusDot status="busy" current={true} />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--busy", "dot--current");
|
||||
});
|
||||
|
||||
it("does not apply dot--current when current is false or omitted", () => {
|
||||
const { container: c1 } = render(<StatusDot status="busy" current={false} />);
|
||||
expect(c1.firstElementChild).not.toHaveClass("dot--current");
|
||||
|
||||
const { container: c2 } = render(<StatusDot status="busy" />);
|
||||
expect(c2.firstElementChild).not.toHaveClass("dot--current");
|
||||
});
|
||||
|
||||
it("supports steady and current modifiers together", () => {
|
||||
const { container } = render(<StatusDot status="busy" steady current />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--busy", "dot--steady", "dot--current");
|
||||
});
|
||||
|
||||
it("preserves custom className alongside modifiers", () => {
|
||||
const { container } = render(<StatusDot status="idle" steady current className="custom-dot" />);
|
||||
expect(container.firstElementChild).toHaveClass("dot", "dot--idle", "dot--steady", "dot--current", "custom-dot");
|
||||
});
|
||||
|
||||
it("exposes the state label when a title is provided", () => {
|
||||
render(<StatusDot status="ok" title="Online" />);
|
||||
expect(screen.getByLabelText("Online")).toHaveAttribute("title", "Online");
|
||||
|
||||
Reference in new issue
Block a user