diff --git a/tests/storybook-visual/task-column-identities.spec.ts b/tests/storybook-visual/task-column-identities.spec.ts new file mode 100644 index 00000000000..30e9a46c8fa --- /dev/null +++ b/tests/storybook-visual/task-column-identities.spec.ts @@ -0,0 +1,44 @@ +import { expect, test } from "@playwright/test"; + +for (const width of [640, 1200]) { + for (const theme of ["light", "dark"]) { + test(`task identities fit their columns at ${width}px in ${theme} mode`, async ({ page }) => { + await page.setViewportSize({ width, height: 800 }); + await page.goto(`/iframe.html?id=task-column-identities--long-names&viewMode=story&globals=theme:${theme}`); + await expect(page.getByTestId("agent-spaces").locator('[data-slot="agent-avatar"]')).toHaveCount(2); + await page.evaluate(() => document.fonts.ready); + + for (const id of ["agent-spaces", "agent-unbroken", "human", "short"]) { + const row = page.getByTestId(id); + const cells = row.locator(":scope > span > span"); + await expect(cells).toHaveCount(4); + for (const index of [0, 1]) { + const cell = cells.nth(index); + const identity = cell.locator("[title]"); + const name = await identity.getAttribute("title"); + const metrics = await identity.evaluate(element => { + const cell = element.parentElement!.getBoundingClientRect(); + const identity = element.getBoundingClientRect(); + const avatar = element.firstElementChild!.getBoundingClientRect(); + const text = element.lastElementChild as HTMLElement; + return { + right: identity.right, cellRight: cell.right, + avatarWidth: avatar.width, avatarLeft: avatar.left, cellLeft: cell.left, + textWidth: text.clientWidth, textContentWidth: text.scrollWidth, + overflow: getComputedStyle(text).textOverflow, + }; + }); + expect(metrics.right, `${id} identity escapes column ${index}`).toBeLessThanOrEqual(metrics.cellRight + 1); + expect(metrics.avatarLeft).toBeGreaterThanOrEqual(metrics.cellLeft); + expect(metrics.avatarWidth).toBe(24); + expect(metrics.textWidth).toBeGreaterThan(0); + expect(metrics.textContentWidth > metrics.textWidth).toBe(id !== "short"); + expect(metrics.overflow).toBe("ellipsis"); + await expect(identity.locator(":scope > span").last()).toHaveText(name!); + } + await expect(cells.nth(2)).toHaveText("Paperclip"); + expect((await row.boundingBox())!.height).toBeLessThanOrEqual((await page.getByTestId("short").boundingBox())!.height); + } + }); + } +} diff --git a/ui/src/components/IssueColumns.tsx b/ui/src/components/IssueColumns.tsx index ce0d244856e..54be14b99f0 100644 --- a/ui/src/components/IssueColumns.tsx +++ b/ui/src/components/IssueColumns.tsx @@ -332,7 +332,7 @@ export function InboxIssueTrailingColumns({ ); @@ -345,7 +345,7 @@ export function InboxIssueTrailingColumns({ name={userLabel} avatarUrl={assigneeUserAvatarUrl} size="sm" - className="min-w-0" + className="min-w-0 max-w-full" /> ); @@ -368,7 +368,7 @@ export function InboxIssueTrailingColumns({ @@ -387,7 +387,7 @@ export function InboxIssueTrailingColumns({ name={creatorUserLabel} avatarUrl={creatorUserAvatarUrl} size="sm" - className="min-w-0" + className="min-w-0 max-w-full" /> diff --git a/ui/storybook/stories/tasks/task-column-identities.stories.tsx b/ui/storybook/stories/tasks/task-column-identities.stories.tsx new file mode 100644 index 00000000000..4cb7ddd66b2 --- /dev/null +++ b/ui/storybook/stories/tasks/task-column-identities.stories.tsx @@ -0,0 +1,62 @@ +import type { Meta, StoryObj } from "@storybook/react-vite"; +import { InboxIssueTrailingColumns } from "@/components/IssueColumns"; +import { storybookIssues } from "../../fixtures/paperclipData"; + +const names = [ + { id: "agent-spaces", name: "Research and Engineering Agent With a Very Long Display Name", human: false }, + { id: "agent-unbroken", name: "ResearchAndEngineeringAgentWithAVeryLongUnbrokenDisplayName", human: false }, + { id: "human", name: "Alexandria Morgan With a Very Long Display Name", human: true }, + { id: "short", name: "Ada", human: false }, +]; + +function TaskColumnIdentities() { + return ( +
+ {names.map(({ id, name, human }) => ( +
+ +
+ ))} +
+ ); +} + +const meta = { + id: "task-column-identities", + title: "Tasks and conversations/Task creation and lifecycle/Column identities", + component: TaskColumnIdentities, + parameters: { + layout: "padded", + paperclip: { + capabilities: ["tasks/organize"], + status: "current", + implementation: "production", + boundary: "fixtures", + notes: "Production task columns with long agent and human names, unbroken names, and a fitting-name control. Verifies layout only; assignment and attribution persistence need live acceptance.", + }, + }, +} satisfies Meta; + +export default meta; +type Story = StoryObj; +export const LongNames: Story = {};