⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
import { TaskLabels } from "./task-labels";
vi.mock("react-i18next", () => ({
useTranslation: () => ({
t: (key: string) => key,
i18n: { language: "en-US", resolvedLanguage: "en-US" },
}),
initReactI18next: { type: "3rdParty", init: vi.fn() },
}));
afterEach(() => {
cleanup();
});
describe("TaskLabels", () => {
it("renders labels supplied by the task", () => {
render(
<TaskLabels labels={[{ id: "label-1", name: "Bug", color: "red" }]} />,
);
expect(screen.getByText("Bug")).toBeVisible();
});
it("uses the card width instead of an arbitrary label-name cap", () => {
const name = "Client: Totem";
render(<TaskLabels labels={[{ id: "label-1", name, color: "purple" }]} />);
const labelName = screen.getByText(name);
const badge = labelName.closest('[data-slot="task-label"]');
expect(labelName).not.toHaveClass("max-w-20");
expect(labelName).toHaveClass("min-w-0", "truncate");
expect(labelName).toHaveAttribute("title", name);
expect(badge).toHaveClass("max-w-full", "min-w-0");
expect(badge?.querySelector('[aria-hidden="true"]')).toHaveClass(
"shrink-0",
);
});
});