mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-19 13:33:35 +08:00
fix: treat skill center as non-session tab
This commit is contained in:
parent
c48eeb5c4e
commit
2dc7404025
@ -1166,6 +1166,38 @@ describe('TabBar', () => {
|
|||||||
expect(useActivityPanelStore.getState().isOpen(tabId)).toBe(false)
|
expect(useActivityPanelStore.getState().isOpen(tabId)).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('treats the skill center tab as a non-session toolbar target', async () => {
|
||||||
|
const { TabBar } = await import('./TabBar')
|
||||||
|
const { SKILL_CENTER_TAB_ID, useTabStore } = await import('../../stores/tabStore')
|
||||||
|
const { useChatStore } = await import('../../stores/chatStore')
|
||||||
|
const { useTerminalPanelStore } = await import('../../stores/terminalPanelStore')
|
||||||
|
|
||||||
|
useTabStore.setState({
|
||||||
|
tabs: [
|
||||||
|
{ sessionId: SKILL_CENTER_TAB_ID, title: 'Skills', type: 'skill-center', status: 'idle' },
|
||||||
|
],
|
||||||
|
activeTabId: SKILL_CENTER_TAB_ID,
|
||||||
|
})
|
||||||
|
useChatStore.setState({
|
||||||
|
sessions: {},
|
||||||
|
disconnectSession: vi.fn(),
|
||||||
|
} as Partial<ReturnType<typeof useChatStore.getState>>)
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
render(<TabBar />)
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(screen.queryByTestId('open-project-menu')).not.toBeInTheDocument()
|
||||||
|
expect(screen.queryByRole('button', { name: 'Show Workspace' })).not.toBeInTheDocument()
|
||||||
|
|
||||||
|
fireEvent.click(screen.getByRole('button', { name: 'Open Terminal' }))
|
||||||
|
|
||||||
|
const terminalTabs = useTabStore.getState().tabs.filter((tab) => tab.type === 'terminal')
|
||||||
|
expect(terminalTabs).toHaveLength(1)
|
||||||
|
expect(useTabStore.getState().activeTabId).toBe(terminalTabs[0]?.sessionId)
|
||||||
|
expect(useTerminalPanelStore.getState().isPanelOpen(SKILL_CENTER_TAB_ID)).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
it('clears session panel state when closing a session tab', async () => {
|
it('clears session panel state when closing a session tab', async () => {
|
||||||
const { TabBar } = await import('./TabBar')
|
const { TabBar } = await import('./TabBar')
|
||||||
const { useTabStore } = await import('../../stores/tabStore')
|
const { useTabStore } = await import('../../stores/tabStore')
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { useShallow } from 'zustand/react/shallow'
|
|||||||
import {
|
import {
|
||||||
SCHEDULED_TAB_ID,
|
SCHEDULED_TAB_ID,
|
||||||
SETTINGS_TAB_ID,
|
SETTINGS_TAB_ID,
|
||||||
|
SKILL_CENTER_TAB_ID,
|
||||||
SUBAGENT_TAB_PREFIX,
|
SUBAGENT_TAB_PREFIX,
|
||||||
TERMINAL_TAB_PREFIX,
|
TERMINAL_TAB_PREFIX,
|
||||||
TRACE_LIST_TAB_ID,
|
TRACE_LIST_TAB_ID,
|
||||||
@ -51,6 +52,7 @@ function isSessionTabId(tabId: string | null) {
|
|||||||
if (!tabId) return false
|
if (!tabId) return false
|
||||||
return tabId !== SETTINGS_TAB_ID &&
|
return tabId !== SETTINGS_TAB_ID &&
|
||||||
tabId !== SCHEDULED_TAB_ID &&
|
tabId !== SCHEDULED_TAB_ID &&
|
||||||
|
tabId !== SKILL_CENTER_TAB_ID &&
|
||||||
tabId !== TRACE_LIST_TAB_ID &&
|
tabId !== TRACE_LIST_TAB_ID &&
|
||||||
!tabId.startsWith(TERMINAL_TAB_PREFIX) &&
|
!tabId.startsWith(TERMINAL_TAB_PREFIX) &&
|
||||||
!tabId.startsWith(TRACE_TAB_PREFIX) &&
|
!tabId.startsWith(TRACE_TAB_PREFIX) &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user