Files
kandev/apps/web/components/task/task-item-priority.test.tsx
T
Henry f441399441 feat(tasks): show and set task priority on the kanban board (#3333)
Co-authored-by: nova28 <17953305+nova28@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
2026-09-05 10:15:19 +00:00

42 lines
1.3 KiB
TypeScript

import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it } from "vitest";
import { TooltipProvider } from "@kandev/ui/tooltip";
import { StateProvider } from "@/components/state-provider";
import { TaskItem } from "./task-item";
afterEach(cleanup);
function renderPriorityItem(priority: "high" | "medium") {
return render(
<StateProvider>
<TooltipProvider>
<TaskItem
title="Priority task"
priority={priority}
prInfo={{ number: 42, state: "Open" }}
/>
</TooltipProvider>
</StateProvider>,
);
}
describe("TaskItem priority", () => {
it("renders priority after the title and before a linked PR badge", () => {
renderPriorityItem("high");
const title = screen.getByText("Priority task");
const priority = screen.getByTestId("sidebar-task-priority-indicator");
const prIcon = screen.getByTestId("pr-task-icon");
expect(title.compareDocumentPosition(priority) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
expect(
priority.compareDocumentPosition(prIcon) & Node.DOCUMENT_POSITION_FOLLOWING,
).toBeTruthy();
});
it("keeps the default medium priority visually quiet", () => {
renderPriorityItem("medium");
expect(screen.queryByTestId("sidebar-task-priority-indicator")).toBeNull();
});
});