test(09-02): add browser-mode component tests for Svelte 5 components

- CompletedToggle: 5 tests for checkbox rendering, state, and interaction
- SearchBar: 7 tests for input, placeholder, recent searches dropdown
- TagInput: 6 tests for rendering with various tag configurations
- Update vitest-setup-client.ts with $app/state, preferences, recentSearches mocks
- All component tests run in real Chromium browser via Playwright
This commit is contained in:
Thomas Richter
2026-02-03 23:36:19 +01:00
parent 283a9214ad
commit 43446b807d
4 changed files with 262 additions and 0 deletions

View File

@@ -34,3 +34,27 @@ vi.mock('$app/environment', () => ({
dev: true,
building: false
}));
// Mock $app/state (Svelte 5 runes-based state)
vi.mock('$app/state', () => ({
page: {
url: new URL('http://localhost'),
params: {},
route: { id: null },
status: 200,
error: null,
data: {},
form: null
}
}));
// Mock preferences store
vi.mock('$lib/stores/preferences.svelte', () => ({
preferences: writable({ showCompleted: false, lastEntryType: 'thought' })
}));
// Mock recent searches store
vi.mock('$lib/stores/recentSearches', () => ({
addRecentSearch: vi.fn(),
recentSearches: writable([])
}));