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:
Jinjing
2026-04-27 23:53:00 -07:00
committed by GitHub
co-authored by Orca
parent bdf5f66ffd
commit 3bf738fc7f
+4 -1
View File
@@ -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>
}