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:
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user