test(admin): convert .not.toThrow into form-stays-mounted assertion (admin/users/new)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-11 17:50:51 +02:00
parent da5da46951
commit 10151fd01b

View File

@@ -79,12 +79,14 @@ describe('admin/users/new page', () => {
expect(banner).toBeNull();
});
it('marks the form dirty after an input event (sets isDirty internally)', async () => {
it('keeps the form mounted after an input event (oninput handler does not unmount)', async () => {
render(AdminUserNewPage, { props: { data: baseData(), form: undefined } });
const form = document.querySelector('form#new-user-form') as HTMLFormElement;
// Dispatch input event on the form to trigger oninput handler
expect(() => form.dispatchEvent(new Event('input', { bubbles: true }))).not.toThrow();
expect(form).not.toBeNull();
form.dispatchEvent(new Event('input', { bubbles: true }));
expect(document.querySelector('form#new-user-form')).not.toBeNull();
});
it('hides the form-error banner when form.error is undefined', async () => {