fix(ticket #7): ajoute le bouton Annuler aux notifications de fin de background task

This commit is contained in:
2026-07-28 19:34:52 +02:00
parent f4ae5df17c
commit 9b150983bb
2 changed files with 54 additions and 5 deletions

View File

@ -268,7 +268,7 @@ describe("ProjectsView — LS7 conversation viewer integration", () => {
const toast = await screen.findByRole("button", {
name: /Appel Main -> DevBackend terminé/i,
});
expect(within(toast).getByText("Task task-ren")).toBeTruthy();
expect(within(toast).getByText("alpha · Task task-ren")).toBeTruthy();
fireEvent.click(toast);
@ -346,7 +346,7 @@ describe("ProjectsView — LS7 conversation viewer integration", () => {
const toast = await screen.findByRole("button", {
name: /Background task failed/i,
});
expect(within(toast).getByText("agent-ge · task-gen")).toBeTruthy();
expect(within(toast).getByText("alpha · agent-ge · task-gen")).toBeTruthy();
fireEvent.click(toast);
@ -355,4 +355,38 @@ describe("ProjectsView — LS7 conversation viewer integration", () => {
).toBeNull();
expect(await screen.findByText("Work")).toBeTruthy();
});
it("prefixes task toast context with a truncatable project-name line and falls back when unresolved", async () => {
const project = new MockProjectGateway();
const created = await project.createProject(
"alpha with a very long project name that must stay on one line",
"/p/a",
);
const system = new MockSystemGateway();
renderView(project, { system });
await openProjectAndWorkTab("/p/a");
system.emit({
type: "backgroundTaskChanged",
projectId: created.id,
agentId: "agent-long-name-context",
taskId: "task-long-name-context",
state: "completed",
});
system.emit({
type: "backgroundTaskChanged",
projectId: "project-not-in-view",
agentId: "agent-fallback-context",
taskId: "task-fallback-context",
state: "failed",
});
const longNameLine = await screen.findByText(
"alpha with a very long project name that must stay on one line · agent-lo · task-lon",
);
expect(longNameLine.className).toContain("truncate");
expect(
await screen.findByText("Projet inconnu · agent-fa · task-fal"),
).toBeTruthy();
});
});