From 5817a791514e53f6a508f25d4089eb4b80c486c3 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 28 Apr 2026 18:17:27 +0200 Subject: [PATCH] =?UTF-8?q?test(stammbaum):=20year-range=20validation=20te?= =?UTF-8?q?st=20for=20AddRelationshipForm=20=E2=80=94=20toYear=20before=20?= =?UTF-8?q?fromYear=20shows=20alert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- .../AddRelationshipForm.svelte.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/src/lib/components/AddRelationshipForm.svelte.spec.ts b/frontend/src/lib/components/AddRelationshipForm.svelte.spec.ts index 5dec75e3..9ddfd8a2 100644 --- a/frontend/src/lib/components/AddRelationshipForm.svelte.spec.ts +++ b/frontend/src/lib/components/AddRelationshipForm.svelte.spec.ts @@ -37,4 +37,20 @@ describe('AddRelationshipForm', () => { document.querySelector('button')!.click(); await expect.element(page.getByRole('button', { name: /^Hinzufügen$/i })).toBeDisabled(); }); + + it('shows year-range error when toYear is before fromYear', async () => { + render(AddRelationshipForm, { personId: 'person-1' }); + document.querySelector('button')!.click(); + await expect.element(page.getByRole('combobox')).toBeInTheDocument(); + + const fromInput = document.querySelector('input[name="fromYear"]')!; + fromInput.value = '1935'; + fromInput.dispatchEvent(new InputEvent('input', { bubbles: true })); + + const toInput = document.querySelector('input[name="toYear"]')!; + toInput.value = '1920'; + toInput.dispatchEvent(new InputEvent('input', { bubbles: true })); + + await expect.element(page.getByRole('alert')).toBeVisible(); + }); });