fix(DateInput): fire onchange when field is cleared
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 1m46s
CI / Backend Unit Tests (pull_request) Failing after 2m37s
CI / E2E Tests (pull_request) Failing after 1h48m16s

Clearing the input set value='' but did not call onchange, so the
korrespondenz filter strip never re-fetched. Added onchange?.() in the
empty-display branch and added a test that confirms the callback fires.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-30 21:22:43 +02:00
parent 616d6ba01c
commit 46eb908ff4
2 changed files with 9 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ function handleInput(e: Event) {
if (result.display === '') {
value = '';
errorMessage = null;
onchange?.();
return;
}

View File

@@ -173,6 +173,14 @@ describe('DateInput clearing the date', () => {
expect(value).toBe('');
expect(errorMessage).toBeNull();
});
it('fires onchange when the field is cleared', async () => {
let called = 0;
render(DateInput, { value: '2024-12-20', onchange: () => called++ });
const input = page.getByRole('textbox');
await input.fill('');
expect(called).toBeGreaterThan(0);
});
});
// ─── Hidden input ─────────────────────────────────────────────────────────────