diff --git a/frontend/src/lib/geschichte/JourneyItemRow.svelte.spec.ts b/frontend/src/lib/geschichte/JourneyItemRow.svelte.spec.ts index ee47da0d..b7d62022 100644 --- a/frontend/src/lib/geschichte/JourneyItemRow.svelte.spec.ts +++ b/frontend/src/lib/geschichte/JourneyItemRow.svelte.spec.ts @@ -52,6 +52,20 @@ describe('JourneyItemRow — note textarea', () => { }); }); +describe('JourneyItemRow — note error state', () => { + it('shows role=alert error message when onNotePatch rejects', async () => { + const onNotePatch = vi.fn().mockRejectedValue(new Error('server error')); + render(JourneyItemRow, { item: docItem(), ...defaultProps({ onNotePatch }) }); + + await userEvent.click(page.getByText('Notiz hinzufügen')); + const textarea = page.getByRole('textbox', { name: /Kuratoren-Notiz für Brief von Karl/ }); + await userEvent.fill(textarea, 'Eine Notiz'); + await textarea.element().dispatchEvent(new FocusEvent('blur')); + + await expect.element(page.getByRole('alert')).toBeInTheDocument(); + }); +}); + describe('JourneyItemRow — interlude rules', () => { it('does not show "Notiz entfernen" for interlude items', async () => { render(JourneyItemRow, { item: interludeItem(), ...defaultProps() });