Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

test(web): cover task label overflow contract

Bryan Nathan7cf0c7583f10
diff --git a/apps/web/src/components/kanban-board/task-labels.test.tsx b/apps/web/src/components/kanban-board/task-labels.test.tsx
index 414797274..20707de9f 100644
--- a/apps/web/src/components/kanban-board/task-labels.test.tsx
+++ b/apps/web/src/components/kanban-board/task-labels.test.tsx
@@ -20,9 +20,13 @@ describe("TaskLabels", () => {
render(<TaskLabels labels={[{ id: "label-1", name, color: "purple" }]} />);
const labelName = screen.getByText(name);
+ const badge = labelName.closest('[data-slot="badge"]');
expect(labelName).not.toHaveClass("max-w-20");
expect(labelName).toHaveClass("min-w-0", "truncate");
expect(labelName).toHaveAttribute("title", name);
- expect(labelName.parentElement).toHaveClass("max-w-full", "min-w-0");
+ expect(badge).toHaveClass("max-w-full", "min-w-0");
+ expect(badge?.querySelector('[aria-hidden="true"]')).toHaveClass(
+ "shrink-0",
+ );
});
});
diff --git a/apps/web/src/components/kanban-board/task-labels.tsx b/apps/web/src/components/kanban-board/task-labels.tsx
index 9f781140f..0c356e97c 100644
--- a/apps/web/src/components/kanban-board/task-labels.tsx
+++ b/apps/web/src/components/kanban-board/task-labels.tsx
@@ -41,13 +41,14 @@ export function TaskLabels({
return (
<div className="flex min-w-0 flex-wrap gap-1">
- {labels.map((label: { id: string; name: string; color: string }) => (
+ {labels.map((label) => (
<Badge
key={label.id}
variant="outline"
className="max-w-full min-w-0 px-2 py-0.5 text-[10px] flex items-center"
>
<span
+ aria-hidden="true"
className="inline-block w-1.5 h-1.5 mr-1 shrink-0 rounded-full"
style={{
backgroundColor: validColor(label.color),