feat(chat): resize vertical du composer avec poignée haut-droit (modèle carnet ticket) — #193

This commit is contained in:
2026-08-14 09:33:05 +02:00
parent d0521db6b6
commit 2b2da223d5
5 changed files with 642 additions and 544 deletions

View File

@ -180,35 +180,47 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
expect(screen.getAllByText(/mock-attachment.txt/).length).toBeGreaterThan(0);
});
it("resizes the custom CLI chat locally per cell and can reset to the default size", async () => {
it("persists custom CLI composer height per layout cell", async () => {
const rectSpy = vi
.spyOn(HTMLElement.prototype, "getBoundingClientRect")
.mockReturnValue({
x: 0,
y: 0,
width: 600,
height: 400,
top: 0,
right: 600,
bottom: 400,
left: 0,
toJSON: () => {},
} as DOMRect);
const gateways = await seeded(structuredProfile);
const layout = gateways.layout as MockLayoutGateway;
const tree = await layout.loadLayout("p1");
const leafId = leaves(tree)[0].id;
window.localStorage.setItem(`idea.agent-cell-mode.p1.${leafId}`, "custom");
renderGrid(gateways);
try {
renderGrid(gateways);
const shell = await screen.findByTestId("custom-agent-chat-shell");
expect(shell.style.width).toBe("100%");
expect(window.localStorage.getItem(`idea.custom-chat-size.p1.${leafId}`)).toBeNull();
const composer = await screen.findByLabelText(/message CLI custom/) as HTMLTextAreaElement;
const handle = screen.getByRole("button", {
name: `redimensionner le composer ${leafId}`,
});
expect(composer.style.height).toBe("64px");
expect(window.localStorage.getItem(`idea.custom-chat-composer-height.p1.${leafId}`))
.toBeNull();
fireEvent.mouseDown(screen.getByRole("button", { name: `resize custom chat ${leafId}` }), {
clientX: 0,
clientY: 0,
});
fireEvent.mouseMove(window, { clientX: 640, clientY: 420 });
fireEvent.mouseUp(window);
fireEvent.mouseDown(handle, { clientY: 200 });
fireEvent.mouseMove(window, { clientY: 100 });
fireEvent.mouseUp(window);
await waitFor(() => expect(shell.style.width).toBe("640px"));
expect(shell.style.height).toBe("420px");
expect(JSON.parse(window.localStorage.getItem(`idea.custom-chat-size.p1.${leafId}`) ?? "{}"))
.toEqual({ width: 640, height: 420 });
fireEvent.click(screen.getByRole("button", { name: `reset custom chat size ${leafId}` }));
await waitFor(() => expect(shell.style.width).toBe("100%"));
expect(window.localStorage.getItem(`idea.custom-chat-size.p1.${leafId}`)).toBeNull();
await waitFor(() => expect(composer.style.height).toBe("164px"));
expect(window.localStorage.getItem(`idea.custom-chat-composer-height.p1.${leafId}`))
.toBe("164");
} finally {
rectSpy.mockRestore();
}
});
it("opens the custom CLI even when the agent already has a structured background session (#169)", async () => {