diff --git a/frontend/src/routes/household/staples/+page.svelte b/frontend/src/routes/household/staples/+page.svelte index 7714ffa..a8012a2 100644 --- a/frontend/src/routes/household/staples/+page.svelte +++ b/frontend/src/routes/household/staples/+page.svelte @@ -50,5 +50,8 @@ {/if}

Vorräte

+ {#if data.ctx === 'settings'} +

Änderungen werden automatisch gespeichert. Gilt ab der nächsten Einkaufsliste.

+ {/if} {/if} diff --git a/frontend/src/routes/household/staples/page.test.ts b/frontend/src/routes/household/staples/page.test.ts index ecdb05c..d4e6080 100644 --- a/frontend/src/routes/household/staples/page.test.ts +++ b/frontend/src/routes/household/staples/page.test.ts @@ -106,4 +106,29 @@ describe('staples page — ctx=settings (D3)', () => { const backLink = screen.getByRole('link', { name: /← einstellungen/i }); expect(backLink).toHaveAttribute('href', '/settings'); }); + + it('renders hint text about autosave', () => { + render(Page, { props: { data: { categories: mockCategories, ctx: 'settings' } } }); + expect(screen.getByText(/änderungen werden automatisch gespeichert/i)).toBeInTheDocument(); + }); + + it('renders hint text about next shopping list', () => { + render(Page, { props: { data: { categories: mockCategories, ctx: 'settings' } } }); + expect(screen.getByText(/gilt ab der nächsten einkaufsliste/i)).toBeInTheDocument(); + }); +}); + +describe('staples page — hint text absent in onboarding', () => { + beforeEach(() => { + vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: true })); + }); + + afterEach(() => { + vi.unstubAllGlobals(); + }); + + it('does not render hint text in onboarding context', () => { + render(Page, { props: { data: { categories: mockCategories, ctx: 'onboarding' } } }); + expect(screen.queryByText(/änderungen werden automatisch gespeichert/i)).not.toBeInTheDocument(); + }); });