From 19daba6f54b3bc99d4645dd3be25cdc6d2be7b4b Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Thu, 20 Aug 2026 08:55:22 +0800 Subject: [PATCH] test(web): align active pinning expectations --- .../SessionList.directory-action.test.tsx | 15 +++------------ web/src/lib/locales/en.ts | 2 +- web/src/lib/locales/zh-CN.ts | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/web/src/components/SessionList.directory-action.test.tsx b/web/src/components/SessionList.directory-action.test.tsx index a82a5df0..bcf486a2 100644 --- a/web/src/components/SessionList.directory-action.test.tsx +++ b/web/src/components/SessionList.directory-action.test.tsx @@ -569,7 +569,7 @@ describe('SessionList collapse behavior', () => { expect(screen.queryByTitle('Idle')).toBeNull() }) - it('keeps quiet active sessions in the Active section when pin-in-progress is on', () => { + it('keeps quiet active sessions in their directory when pin-in-progress is on', () => { localStorage.setItem('hapi-pin-in-progress-sessions', 'true') const sessions = [ makeSession({ @@ -598,17 +598,9 @@ describe('SessionList collapse behavior', () => { expect(screen.getByTitle('In progress')).toBeInTheDocument() expect(screen.getByText(/Running \(1\)/)).toBeInTheDocument() expect(screen.getByText(/pending \(1\)/)).toBeInTheDocument() - // Quiet active sessions float into their own Active section (finished - // executing, still connected) instead of falling into directory groups. - expect(screen.getByTitle('Active sessions')).toBeInTheDocument() - expect(screen.getByText(/Active \(1\)/)).toBeInTheDocument() expect(screen.getByRole('button', { name: /Quiet task/ })).toBeInTheDocument() - // The directory header survives as an action-only header (copy-path / - // new-session-in-directory) even though every row floated. expect(screen.getByTitle('/work/hapi')).toBeInTheDocument() - expect(screen.getByTitle('/work/hapi').nextElementSibling).toBeNull() expect(screen.getByTitle('/work/other')).toBeInTheDocument() - expect(screen.getByTitle('/work/other').nextElementSibling).toBeNull() }) it('keeps new-session-in-directory actions for projects whose rows all floated', () => { @@ -636,10 +628,8 @@ describe('SessionList collapse behavior', () => { /> ) - expect(screen.getByTitle('Active sessions')).toBeInTheDocument() - // The project header survives as an action-only header. const header = screen.getByTitle('/work/hapi') - expect(header.nextElementSibling).toBeNull() + expect(header.nextElementSibling).not.toBeNull() fireEvent.click(screen.getByRole('button', { name: 'New session in this directory' })) expect(onNewSessionInDirectory).toHaveBeenCalledWith({ @@ -739,6 +729,7 @@ describe('SessionList collapse behavior', () => { it('toggles the Active section independently of In progress', () => { localStorage.setItem('hapi-pin-in-progress-sessions', 'true') + localStorage.setItem('hapi-pin-active-sessions', 'true') const sessions = [ makeSession({ id: 'session-running', diff --git a/web/src/lib/locales/en.ts b/web/src/lib/locales/en.ts index 866c7b26..0100ecfd 100644 --- a/web/src/lib/locales/en.ts +++ b/web/src/lib/locales/en.ts @@ -839,7 +839,7 @@ export default { 'settings.display.activeSessionsOnly': 'Active sessions only', 'settings.display.activeSessionsOnly.desc': 'Hide inactive sessions in the sidebar. The session you have open stays visible.', 'settings.display.pinInProgressSessions': 'Pin in-progress sessions', - 'settings.display.pinInProgressSessions.desc': 'Move unpinned connected sessions into sections above project folders: running and pending work first, then quiet active sessions (finished executing, still connected). Global pins remain above them. Off keeps everything in directory groups.', + 'settings.display.pinInProgressSessions.desc': 'Move unpinned working and pending sessions into sections above project folders. Quiet active sessions stay in their project folders unless Pin active sessions is enabled.', 'settings.display.pinActiveSessions': 'Pin active sessions', 'settings.display.pinActiveSessions.desc': 'Move all connected sessions to the top, including sessions that are currently idle.', 'settings.display.sessionListStatus': 'Session list status hints', diff --git a/web/src/lib/locales/zh-CN.ts b/web/src/lib/locales/zh-CN.ts index f822c996..0affa65b 100644 --- a/web/src/lib/locales/zh-CN.ts +++ b/web/src/lib/locales/zh-CN.ts @@ -838,7 +838,7 @@ export default { 'settings.display.activeSessionsOnly': '仅显示活跃会话', 'settings.display.activeSessionsOnly.desc': '在侧边栏隐藏非活跃会话;当前打开的会话仍会保留显示。', 'settings.display.pinInProgressSessions': '置顶进行中会话', - 'settings.display.pinInProgressSessions.desc': '将未置顶的已连接会话移到项目文件夹上方的分区:先运行中和待处理,再是安静的活跃会话(已执行完但仍在连接)。全局置顶仍在其上。关闭后全部保留在目录分组中。', + 'settings.display.pinInProgressSessions.desc': '将未置顶的运行中和待处理会话移到项目目录上方。空闲的活跃会话留在项目目录中,除非开启「置顶活跃会话」。', 'settings.display.pinActiveSessions': '置顶活跃会话', 'settings.display.pinActiveSessions.desc': '将所有仍连接的会话移到顶部,包括当前空闲的活跃会话。', 'settings.display.sessionListStatus': '会话列表状态提示',