fix: allow closing last session tab and restore DevTools shortcut
Closing the sole remaining non-welcome tab now resets to welcome; enable Tauri devtools, menu/shortcut toggle, and copy release artifacts from CARGO_TARGET_DIR. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
da95113e6d
commit
188f3556ed
14 files changed
+95
-38
No files matched your search
@@ -72,15 +72,32 @@ describe('TabStore', () => {
|
||||
})
|
||||
|
||||
describe('closeTab', () => {
|
||||
it('不应该关闭最后一个标签', () => {
|
||||
it('不应该关闭最后一个欢迎页', () => {
|
||||
const { closeTab } = useTabStore.getState()
|
||||
const closed = closeTab('welcome')
|
||||
|
||||
const { tabs } = useTabStore.getState()
|
||||
expect(tabs).toHaveLength(1)
|
||||
expect(tabs[0].type).toBe('welcome')
|
||||
expect(closed).toBeNull()
|
||||
})
|
||||
|
||||
it('关闭最后一个会话标签应回到欢迎页', () => {
|
||||
const { addTab, closeOtherTabs, closeTab } = useTabStore.getState()
|
||||
addTab({ title: 'Tab 1', type: 'terminal' })
|
||||
const session = useTabStore.getState().tabs.find((t) => t.title === 'Tab 1')
|
||||
expect(session).toBeTruthy()
|
||||
closeOtherTabs(session!.id)
|
||||
|
||||
expect(useTabStore.getState().tabs).toHaveLength(1)
|
||||
const closed = closeTab(session!.id)
|
||||
const { tabs, activeTabId } = useTabStore.getState()
|
||||
expect(closed?.title).toBe('Tab 1')
|
||||
expect(tabs).toHaveLength(1)
|
||||
expect(tabs[0].type).toBe('welcome')
|
||||
expect(activeTabId).toBe('welcome')
|
||||
})
|
||||
|
||||
it('关闭标签后应该激活另一个标签', () => {
|
||||
const { addTab, closeTab } = useTabStore.getState()
|
||||
addTab({ title: 'Tab 1', type: 'terminal' })
|
||||
|
||||
Reference in new issue
Block a user