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();