Files
PaperClipAI/ui/src/components/EntityRow.test.tsx
T
scotttongandClaude Opus 4.8 f11b6a5075 PAP-85: fix All Agents table layout (model/date overlap, spacing)
Approach A from the approved PAP-84 plan, applied to both the list and org
metadata blocks on the All Agents page.

- Provider/model collision: replace the two side-by-side spans with one
  fixed-width AgentMetaColumns cell (w-44) holding two truncating lines —
  configured model (primary) over adapter label (muted, smaller). Each line
  clips with an ellipsis + title tooltip instead of spilling.
- Dates on one line: heartbeat cell gets whitespace-nowrap and widens
  w-16 -> w-24 so a full date like "Apr 30, 2026" never wraps.
- Name<->columns gap: add an optional meta slot to EntityRow. When present the
  title stops flex-growing and a flex-1 spacer is inserted between meta and
  trailing, so metadata sits next to the name while the status badge + action
  buttons stay pinned right. Backward compatible — existing callers pass no meta.
- Lower the metadata reveal breakpoint from 2xl to xl in both views.

Tests: Agents asserts codex_local + gpt-5.4 present and the heartbeat cell is
single-line; EntityRow gains meta-slot + spacer cases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:59:42 -07:00

50 lines
1.6 KiB
TypeScript

import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it, vi } from "vitest";
import { EntityRow } from "./EntityRow";
vi.mock("@/lib/router", () => ({
Link: ({ children, to, ...props }: React.ComponentProps<"a"> & { to: string }) => (
<a href={to} {...props}>
{children}
</a>
),
}));
describe("EntityRow", () => {
it("keeps caller text color classes on linked rows", () => {
const markup = renderToStaticMarkup(
<EntityRow
title="Left project"
to="/projects/left-project"
className="group text-foreground/55"
/>,
);
expect(markup).toContain("text-foreground/55");
expect(markup).not.toContain("text-inherit");
});
it("renders an optional meta slot and stops the title from flex-growing", () => {
const markup = renderToStaticMarkup(
<EntityRow
title="Alpha"
meta={<span data-testid="meta-cell">gpt-5.4</span>}
trailing={<span data-testid="trailing-cell">badge</span>}
/>,
);
// meta content renders alongside trailing
expect(markup).toContain("meta-cell");
expect(markup).toContain("trailing-cell");
// a flex-1 spacer is inserted (between meta and trailing); the title block
// itself no longer flex-grows
expect(markup).toContain('class="flex-1"');
expect(markup).not.toContain("min-w-0 flex-1");
});
it("keeps the title flex-growing when no meta is provided", () => {
const markup = renderToStaticMarkup(<EntityRow title="Alpha" />);
expect(markup).toContain("min-w-0 flex-1");
});
});