diff --git a/frontend/src/features/agents/CustomAgentChatView.test.tsx b/frontend/src/features/agents/CustomAgentChatView.test.tsx index 57a3d2bf..a80d5f7f 100644 --- a/frontend/src/features/agents/CustomAgentChatView.test.tsx +++ b/frontend/src/features/agents/CustomAgentChatView.test.tsx @@ -1,4 +1,6 @@ import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react"; +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; import { useState } from "react"; import { beforeEach, describe, expect, it, vi } from "vitest"; @@ -25,6 +27,11 @@ import { customAgentChatQueueCount, } from "./CustomAgentChatView"; +const themeCss = readFileSync( + resolve(process.cwd(), "src/shared/styles/theme.css"), + "utf8", +); + const profile: AgentProfile = { id: "structured", name: "Structured Codex", @@ -199,6 +206,63 @@ describe("CustomAgentChatView", () => { __resetProjectCliInteractionActivityForTests(); }); + it.each([ + { width: 600, mode: "single-row" }, + { width: 360, mode: "second-row" }, + { width: 240, mode: "full-width" }, + ])("keeps its conversation access clear of cell controls at $width px ($mode)", ({ width, mode }) => { + const agent = { + reattachAgentChat: vi.fn(async (sessionId: string) => ({ sessionId, scrollback: [] })), + sendAgentChat: vi.fn(), + cancelAgentChat: vi.fn(), + closeAgentChat: vi.fn(), + }; + + render( +
+ null) } } as unknown as Gateways}> + + +
, + ); + + const header = screen.getByTestId("custom-agent-chat-header"); + const identity = screen.getByTestId("custom-agent-chat-identity"); + const conversations = screen.getByTestId("custom-agent-chat-conversations"); + const button = screen.getByRole("button", { name: "Conversations" }); + + expect(screen.getByTestId("representative-cell").style.width).toBe(`${width}px`); + expect(header.className).toContain("custom-agent-chat-header"); + expect(header.contains(identity)).toBe(true); + expect(header.contains(conversations)).toBe(true); + expect(conversations.contains(button)).toBe(true); + expect(screen.getByText("CLI personnalisée · Structured Codex")).toBeTruthy(); + expect(themeCss).toContain("padding: 2.25rem 0.75rem 0.5rem"); + + if (mode === "single-row") { + expect(themeCss).toContain(".custom-agent-chat-conversations-menu {\n right: 0;"); + } else { + expect(themeCss).toContain("@container (max-width: 419.99px)"); + expect(themeCss).toContain("flex-direction: column"); + expect(themeCss).toContain("left: 0"); + } + if (mode === "full-width") { + expect(themeCss).toContain("@container (max-width: 279.99px)"); + expect(themeCss).toContain(".custom-agent-chat-conversations-button,\n .custom-agent-chat-conversations-menu"); + } + }); + it("renders the project icon as a non-interactive custom-CLI watermark and updates it immediately", async () => { const agent = { reattachAgentChat: vi.fn(async (sessionId: string) => ({ sessionId, scrollback: [] })), diff --git a/frontend/src/features/agents/CustomAgentChatView.tsx b/frontend/src/features/agents/CustomAgentChatView.tsx index 29f29b62..469b9912 100644 --- a/frontend/src/features/agents/CustomAgentChatView.tsx +++ b/frontend/src/features/agents/CustomAgentChatView.tsx @@ -2966,18 +2966,26 @@ export function CustomAgentChatView({
-
+
{agentName}
{tr("CLI personnalisée", "Custom CLI")} · {profile.name}
-
+