This commit is contained in:
@ -111,8 +111,9 @@ describe("CustomAgentChatView", () => {
|
||||
expect.any(Function),
|
||||
),
|
||||
);
|
||||
expect(screen.queryByRole("button", { name: "Cancel" })).toBeNull();
|
||||
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Cancel" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Stop" }));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(agent.cancelAgentChat).toHaveBeenCalledWith("chat-session-1"),
|
||||
@ -1080,7 +1081,7 @@ describe("CustomAgentChatView", () => {
|
||||
expect(screen.getByText("Fichier: paste-image.png")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("accepts pasted images exposed only through clipboardData.files", async () => {
|
||||
it("accepts pasted generic files exposed only through clipboardData.files", async () => {
|
||||
const agent = {
|
||||
launchAgentChat: vi.fn(),
|
||||
reattachAgentChat: vi.fn(async (sessionId: string) => ({
|
||||
@ -1121,7 +1122,7 @@ describe("CustomAgentChatView", () => {
|
||||
),
|
||||
);
|
||||
|
||||
const file = new File(["ignored"], "files-only.png", { type: "image/png" });
|
||||
const file = new File(["ignored"], "files-only.pdf", { type: "application/pdf" });
|
||||
Object.defineProperty(file, "arrayBuffer", {
|
||||
value: vi.fn(async () => new Uint8Array([4, 5, 6]).buffer),
|
||||
});
|
||||
@ -1133,7 +1134,8 @@ describe("CustomAgentChatView", () => {
|
||||
},
|
||||
});
|
||||
|
||||
await screen.findByText("Fichier joint: files-only.png");
|
||||
await screen.findByText("Fichier joint: files-only.pdf");
|
||||
expect(screen.queryByTestId("attachment-preview-files-only.pdf")).toBeNull();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Envoyer" }));
|
||||
|
||||
await waitFor(() => expect(agent.sendAgentChat).toHaveBeenCalledTimes(1));
|
||||
@ -1144,9 +1146,9 @@ describe("CustomAgentChatView", () => {
|
||||
{
|
||||
attachments: [
|
||||
{
|
||||
filename: "files-only.png",
|
||||
filename: "files-only.pdf",
|
||||
contentBase64: "BAUG",
|
||||
mime: "image/png",
|
||||
mime: "application/pdf",
|
||||
sourceKind: "clipboard",
|
||||
},
|
||||
],
|
||||
@ -1194,14 +1196,12 @@ describe("CustomAgentChatView", () => {
|
||||
});
|
||||
const scroll = screen.getByTestId("custom-agent-chat-scroll");
|
||||
const composer = screen.getByTestId("custom-agent-chat-composer");
|
||||
const cancel = await screen.findByRole("button", { name: "Cancel" });
|
||||
|
||||
expect(shell.className).toContain("h-full");
|
||||
expect(shell.className).toContain("min-h-0");
|
||||
expect(shell.className).toContain("overflow-hidden");
|
||||
expect(toolbar.className).toContain("overflow-hidden");
|
||||
expect(cancel.className).toContain("shrink-0");
|
||||
expect(cancel.className).toContain("z-30");
|
||||
expect(screen.queryByRole("button", { name: "Cancel" })).toBeNull();
|
||||
expect(scroll.className).toContain("flex-1");
|
||||
expect(scroll.className).toContain("basis-0");
|
||||
expect(scroll.className).toContain("overflow-y-auto");
|
||||
@ -1520,7 +1520,7 @@ describe("CustomAgentChatView", () => {
|
||||
fireEvent.click(screen.getByRole("button", { name: "Envoyer" }));
|
||||
await waitFor(() => expect(agent.sendAgentChat).toHaveBeenCalled());
|
||||
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Cancel" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Stop" }));
|
||||
|
||||
expect(await screen.findByText("Session déjà fermée.")).toBeTruthy();
|
||||
expect(onSessionId).toHaveBeenCalledWith(null);
|
||||
|
||||
Reference in New Issue
Block a user