diff --git a/frontend/src/lib/components/TagInput.svelte.spec.ts b/frontend/src/lib/components/TagInput.svelte.spec.ts index a0c37b6d..8605a236 100644 --- a/frontend/src/lib/components/TagInput.svelte.spec.ts +++ b/frontend/src/lib/components/TagInput.svelte.spec.ts @@ -255,6 +255,18 @@ describe('TagInput – autocomplete', () => { await waitForFetch(); await expect.element(page.getByRole('listbox')).toBeInTheDocument(); }); + + it('selects a suggestion via Enter when allowCreation=false', async () => { + mockFetchWithTags(['Familie']); + render(TagInput, { tags: [], allowCreation: false }); + const input = page.getByRole('textbox'); + await input.fill('Fa'); + await waitForFetch(); + await userEvent.keyboard('{ArrowDown}'); // index 0 → Familie + await userEvent.keyboard('{Enter}'); + await expect.element(page.getByText('Familie')).toBeInTheDocument(); + await expect.element(input).toHaveValue(''); + }); }); // ─── Tree-aware ordering ──────────────────────────────────────────────────────