MCPcopy
hub / github.com/coder/mux / getWorkspaceUnreadIndicator

Function getWorkspaceUnreadIndicator

tests/ui/chat/unreadIndicator.test.ts:50–69  ·  view source on GitHub ↗

* Find the workspace element in the sidebar and check if it shows the unread indicator.

(
  container: HTMLElement,
  workspaceId: string
)

Source from the content-addressed store, hash-verified

48 * Find the workspace element in the sidebar and check if it shows the unread indicator.
49 */
50function getWorkspaceUnreadIndicator(
51 container: HTMLElement,
52 workspaceId: string
53): { element: HTMLElement; hasUnreadBar: boolean } | null {
54 const workspaceEl = container.querySelector(
55 `[data-workspace-id="${workspaceId}"]`
56 ) as HTMLElement | null;
57
58 if (!workspaceEl) return null;
59
60 // The unread indicator is a StatusDot span with the idle/unread styling
61 const statusDot = workspaceEl.querySelector(
62 'span[class*="bg-surface-invert-secondary"]'
63 ) as HTMLElement | null;
64
65 return {
66 element: workspaceEl,
67 hasUnreadBar: statusDot !== null && !statusDot.className.includes("opacity-0"),
68 };
69}
70
71describe("Unread indicator (mock AI router)", () => {
72 beforeAll(async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected