test: cover UserProfileSection and AccountSection branches

UserProfileSection: four input fields render, prop hydration including
German date conversion, hidden ISO birthDate input, contact textarea
hydration, empty defaults.

AccountSection: heading, email input attributes, password input
attributes.

9 tests across two account-form helpers.

Refs #496.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-10 00:31:28 +02:00
committed by marcel
parent 2772652bc6
commit 950dd116df
2 changed files with 96 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { describe, it, expect, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import AccountSection from './AccountSection.svelte';
afterEach(cleanup);
describe('AccountSection', () => {
it('renders the section heading', async () => {
render(AccountSection, { props: {} });
await expect.element(page.getByRole('heading', { name: /benutzerverwaltung/i })).toBeVisible();
});
it('renders the email input as type=email and required', async () => {
render(AccountSection, { props: {} });
const email = document.querySelector('input[name="email"]') as HTMLInputElement;
expect(email.type).toBe('email');
expect(email.required).toBe(true);
expect(email.autocomplete).toBe('email');
});
it('renders the password input as type=password and required', async () => {
render(AccountSection, { props: {} });
const pwd = document.querySelector('input[name="password"]') as HTMLInputElement;
expect(pwd.type).toBe('password');
expect(pwd.required).toBe(true);
});
});