test(ui): fix openTaskPage tests by including nav-history slice (#1208)
* feat(nav): back/forward traverses Tasks page visits Widens worktree nav history entries to string | 'tasks' so the titlebar back/forward buttons and Cmd/Ctrl+Alt+Arrow shortcut work from the Tasks page. openTaskPage records a 'tasks' entry; closeTaskPage rewinds the index when parked on one; goBack/goForward dispatches Tasks entries via a separate view activator to bypass openTaskPage side effects. Co-authored-by: Orca <help@stably.ai> * test(ui): include worktree-nav-history slice in test store openTaskPage calls get().recordViewVisit('tasks'), which lives in the worktree-nav-history slice. The ui.test.ts store was composing only the UI slice, so the two settings-navigation tests threw TypeError: get(...).recordViewVisit is not a function. Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -3,15 +3,18 @@ import { describe, expect, it } from 'vitest'
|
||||
import { getDefaultUIState } from '../../../../shared/constants'
|
||||
import type { PersistedUIState } from '../../../../shared/types'
|
||||
import { createUISlice } from './ui'
|
||||
import { createWorktreeNavHistorySlice } from './worktree-nav-history'
|
||||
import type { AppState } from '../types'
|
||||
|
||||
function createUIStore(): StoreApi<AppState> {
|
||||
// Only the UI slice, repo ids, and right sidebar width fallback are needed
|
||||
// for persisted UI hydration tests.
|
||||
// for persisted UI hydration tests. The worktree-nav-history slice is also
|
||||
// included because openTaskPage records a Tasks visit via recordViewVisit.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return createStore<any>()((...args: any[]) => ({
|
||||
repos: [],
|
||||
rightSidebarWidth: 280,
|
||||
...createWorktreeNavHistorySlice(...(args as Parameters<typeof createWorktreeNavHistorySlice>)),
|
||||
...createUISlice(...(args as Parameters<typeof createUISlice>))
|
||||
})) as unknown as StoreApi<AppState>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user