diff --git a/frontend/src/routes/household/setup/+page.svelte b/frontend/src/routes/household/setup/+page.svelte new file mode 100644 index 0000000..8e24d8b --- /dev/null +++ b/frontend/src/routes/household/setup/+page.svelte @@ -0,0 +1,42 @@ + + + + Haushalt einrichten — Mealplan + + +
+ + + + +
+ +
+

+ Schritt 1 von 3 +

+
+ + +
+
+ +
+
+
+
diff --git a/frontend/src/routes/household/setup/page.test.ts b/frontend/src/routes/household/setup/page.test.ts new file mode 100644 index 0000000..ef01078 --- /dev/null +++ b/frontend/src/routes/household/setup/page.test.ts @@ -0,0 +1,53 @@ +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/svelte'; +import Page from './+page.svelte'; + +vi.mock('$app/forms', () => ({ + enhance: () => ({ destroy: () => {} }) +})); + +describe('household setup page', () => { + it('renders the form heading', () => { + render(Page); + expect(screen.getByText('Haushalt benennen')).toBeInTheDocument(); + }); + + it('renders the household name input', () => { + render(Page); + expect(screen.getByLabelText('Haushaltsname')).toBeInTheDocument(); + }); + + it('renders the continue button', () => { + render(Page); + expect(screen.getByRole('button', { name: /weiter/i })).toBeInTheDocument(); + }); + + it('renders the ProgressSidebar with step 1 active', () => { + render(Page); + const step1 = screen.getByTestId('step-1'); + expect(step1).toHaveAttribute('aria-current', 'step'); + }); + + it('renders steps 2 and 3 as future steps', () => { + render(Page); + expect(screen.getByTestId('step-2')).not.toHaveAttribute('aria-current'); + expect(screen.getByTestId('step-3')).not.toHaveAttribute('aria-current'); + }); + + it('does not render app navigation chrome', () => { + render(Page); + // No nav links like Planer or Rezepte (those are app shell nav items) + expect(screen.queryByText('Planer')).not.toBeInTheDocument(); + expect(screen.queryByText('Rezepte')).not.toBeInTheDocument(); + }); + + it('sets the page title', () => { + render(Page); + expect(document.title).toBe('Haushalt einrichten — Mealplan'); + }); + + it('renders the mobile step indicator text', () => { + render(Page); + expect(screen.getByText(/schritt 1 von 3/i)).toBeInTheDocument(); + }); +}); diff --git a/frontend/src/routes/household/staples/+page.svelte b/frontend/src/routes/household/staples/+page.svelte new file mode 100644 index 0000000..6a67101 --- /dev/null +++ b/frontend/src/routes/household/staples/+page.svelte @@ -0,0 +1,7 @@ + + Vorräte einrichten — Mealplan + + +
+

A3 — Vorräte einrichten (coming soon)

+
diff --git a/frontend/src/test-setup.ts b/frontend/src/test-setup.ts new file mode 100644 index 0000000..41b13c7 --- /dev/null +++ b/frontend/src/test-setup.ts @@ -0,0 +1,7 @@ +import '@testing-library/jest-dom/vitest'; +import { configure } from '@testing-library/dom'; + +// Exclude elements inside aria-hidden containers from text queries, +// so that visually-hidden sidebars (e.g. ProgressSidebar in onboarding pages) +// don't create duplicate text matches when the same text appears in the main content. +configure({ defaultIgnore: 'script, style, [aria-hidden="true"] *' });