diff --git a/ui/src/components/StatusIcon.test.tsx b/ui/src/components/StatusIcon.test.tsx new file mode 100644 index 00000000000..68b5363fe51 --- /dev/null +++ b/ui/src/components/StatusIcon.test.tsx @@ -0,0 +1,24 @@ +// @vitest-environment jsdom +import { act } from "react"; +import { createRoot } from "react-dom/client"; +import { expect, it, vi } from "vitest"; +import { StatusIcon } from "./StatusIcon"; + +it.each(["in_review", "in_progress"])("animates only the current in-progress glyph when picking a status from %s", async (status) => { + const host = document.body.appendChild(document.createElement("div")); + const root = createRoot(host); + try { + await act(async () => root.render()); + const trigger = host.querySelector("button")!; + await act(async () => trigger.click()); + + const option = document.querySelector('[role="dialog"] svg[aria-label="In Progress"]'); + expect(option).toBeTruthy(); + const isInProgress = status === "in_progress"; + expect(option!.classList.contains("motion-safe:animate-spin")).toBe(isInProgress); + expect(trigger.querySelector("svg")!.classList.contains("motion-safe:animate-spin")).toBe(isInProgress); + } finally { + await act(async () => root.unmount()); + host.remove(); + } +}); diff --git a/ui/src/components/StatusIcon.tsx b/ui/src/components/StatusIcon.tsx index 43bc4988977..8fee6843fab 100644 --- a/ui/src/components/StatusIcon.tsx +++ b/ui/src/components/StatusIcon.tsx @@ -101,7 +101,11 @@ export function StatusIcon({ status, displayStatus: presentationStatus, external }} > {/* The current row is the task's state: draw it exactly like the trigger. */} - + {taskStatusLabel(s)} ))}