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