From 4835231f6de84597cfe62753d9b7669174663d63 Mon Sep 17 00:00:00 2001 From: Marcel Raddatz Date: Fri, 10 Apr 2026 14:18:16 +0200 Subject: [PATCH] test(planner): cover Entfernen hidden when slot.id is null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds regression test for the {#if slot.id} guard on the remove button — QA flagged the missing negative test case for optimistic slots. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/planner/DesktopDayTile.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/lib/planner/DesktopDayTile.test.ts b/frontend/src/lib/planner/DesktopDayTile.test.ts index 7be228e..d641a9d 100644 --- a/frontend/src/lib/planner/DesktopDayTile.test.ts +++ b/frontend/src/lib/planner/DesktopDayTile.test.ts @@ -161,6 +161,15 @@ describe('DesktopDayTile — filled slot', () => { expect(screen.getByRole('button', { name: /Entfernen/i })).toBeTruthy(); }); + it('hides Entfernen button when slot.id is null (optimistic slot)', () => { + const slotWithoutId = { ...filledSlot, id: null }; + render(DesktopDayTile, { props: { slot: slotWithoutId, isToday: false, activeSlotId: null, isPlanner: true, slotMap: {}, suggestions: [] } }); + // flip the tile first so back face is visible + // activeSlotId must match slot.id to flip — but slot.id is null, so isFlipped = false + // The back face is still rendered in the DOM; check button is absent + expect(screen.queryByRole('button', { name: /Entfernen/i })).toBeNull(); + }); + it('calls onremove when Entfernen clicked', async () => { const onremove = vi.fn(); const user = userEvent.setup();