feat(settings): add autosave hint text below StaplesManager on D3 when ctx=settings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 16:30:19 +02:00
parent 0b3d062ed1
commit 48802a04f7
2 changed files with 28 additions and 0 deletions

View File

@@ -50,5 +50,8 @@
{/if} {/if}
<h1 class="mb-[8px] font-[var(--font-display)] text-[18px] font-medium md:text-[28px] text-[var(--color-text)]">Vorräte</h1> <h1 class="mb-[8px] font-[var(--font-display)] text-[18px] font-medium md:text-[28px] text-[var(--color-text)]">Vorräte</h1>
<StaplesManager categories={data.categories} context="settings" /> <StaplesManager categories={data.categories} context="settings" />
{#if data.ctx === 'settings'}
<p class="mt-4 font-[var(--font-sans)] text-[11px] text-[var(--color-text-muted)]">Änderungen werden automatisch gespeichert. Gilt ab der nächsten Einkaufsliste.</p>
{/if}
</div> </div>
{/if} {/if}

View File

@@ -106,4 +106,29 @@ describe('staples page — ctx=settings (D3)', () => {
const backLink = screen.getByRole('link', { name: /← einstellungen/i }); const backLink = screen.getByRole('link', { name: /← einstellungen/i });
expect(backLink).toHaveAttribute('href', '/settings'); 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();
});
}); });