From ed4ef885983701a3c908a70d6cd03faef0bd37f9 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 9 Jun 2026 16:46:30 +0200 Subject: [PATCH] test(journey-item-row): add note-patch rejection error-state test The noteError alert path (role=alert paragraph) was untested. The catch block in handleNoteBlur was already implemented; this test verifies it renders the alert when onNotePatch rejects. Co-Authored-By: Claude Sonnet 4.6 --- .../lib/geschichte/JourneyItemRow.svelte.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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() });