import { cleanup, fireEvent, render, screen, within } from "@testing-library/react"; import { afterEach, describe, expect, it, vi } from "vitest"; import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "@kandev/ui/context-menu"; import { StateProvider } from "@/components/state-provider"; import { TaskManagementMenu } from "./task-management-menu"; afterEach(cleanup); describe("focused shared task actions", () => { // @covers AC-TASKS-THREADS-ACTIONS-001.1, AC-TASKS-THREADS-ACTIONS-001.2, AC-TASKS-THREADS-ACTIONS-001.3 it("preserves current-step eligibility and dispatches the chosen priority", async () => { const onPriority = vi.fn(); render( Open , ); fireEvent.contextMenu(screen.getByText("Open")); expect(screen.queryByText("Send to workflow")).toBeNull(); fireEvent.pointerMove(screen.getByTestId("task-context-move-to"), { pointerType: "mouse" }); const current = await screen.findByTestId("task-context-step-s1"); expect(current.getAttribute("aria-disabled")).toBe("true"); fireEvent.pointerMove(screen.getByTestId("task-context-priority"), { pointerType: "mouse" }); const high = await screen.findByTestId("task-context-priority-high"); expect(within(high).getByText("Current")).toBeTruthy(); fireEvent.click(screen.getByTestId("task-context-priority-low")); expect(onPriority).toHaveBeenCalledWith("low"); }); });