feat(tickets): sélection de ticket via popup dans la gestion de sprint (#19)

Lot D du sprint UI rework : branche la popup réutilisable TicketPicker (#18)
dans la sélection de ticket de la création/édition de sprint.

- SprintManager : sélection de ticket déléguée à la popup TicketPicker
- TicketsPanel : ajustements liés à l'intégration

Tests : tsc --noEmit clean, suite complète 528/528, suite tickets 38/38
(dont 2 nouveaux tests #19).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-06 21:01:06 +02:00
parent a118069f80
commit 5a0d9f0db4
3 changed files with 78 additions and 32 deletions

View File

@ -805,23 +805,46 @@ describe("SprintManager (#11)", () => {
expect(fresh.title).toBe("Kept");
});
it("adds a backlog ticket to a sprint via the add selector", async () => {
it("adds a backlog ticket to a sprint via the TicketPicker popup (#19)", async () => {
ticket._seedSprint(PROJECT_ID, { id: "s1", order: 1, name: "Target" });
const t = await ticket.create(PROJECT_ID, { title: "Backlog item" });
const dialog = await openManager();
fireEvent.change(
// Open the add-ticket picker for the Target sprint.
fireEvent.click(
await within(dialog).findByLabelText("add ticket to sprint Target"),
{ target: { value: t.ref } },
);
// The picker popup lists the backlog ticket — select it.
fireEvent.click(await screen.findByLabelText(`select ticket ${t.ref}`));
await waitFor(async () => {
const fresh = await ticket.read(PROJECT_ID, t.ref);
expect(fresh.sprintId).toBe("s1");
});
});
it("excludes tickets already in the sprint from the add picker (#19)", async () => {
ticket._seedSprint(PROJECT_ID, { id: "s1", order: 1, name: "Target" });
const member = await ticket.create(PROJECT_ID, { title: "Already in" });
await ticket.setTicketSprint(PROJECT_ID, member.ref, "s1", member.version);
const backlog = await ticket.create(PROJECT_ID, { title: "Still backlog" });
const dialog = await openManager();
fireEvent.click(
await within(dialog).findByLabelText("add ticket to sprint Target"),
);
// The backlog ticket is offered; the one already in the sprint is excluded.
expect(
await screen.findByLabelText(`select ticket ${backlog.ref}`),
).toBeTruthy();
expect(
screen.queryByLabelText(`select ticket ${member.ref}`),
).toBeNull();
});
it("removes a ticket from a sprint", async () => {
ticket._seedSprint(PROJECT_ID, { id: "s1", order: 1, name: "Holder" });
const t = await ticket.create(PROJECT_ID, { title: "Member" });