fix: tighten collapsed sidebar layout (#834)

This commit is contained in:
Zhicheng Han
2026-05-19 02:33:53 +02:00
committed by GitHub
parent d2cbce2f13
commit 3d74d78698
11 changed files with 131 additions and 16 deletions
+30
View File
@@ -82,6 +82,7 @@ describe('AppSidebar search entry', () => {
mockAppStore.updateAvailable = false
mockAppStore.clientOutdated = false
mockAppStore.updating = false
mockAppStore.sidebarCollapsed = false
mockAppStore.reloadClient.mockClear()
})
@@ -127,4 +128,33 @@ describe('AppSidebar search entry', () => {
await reloadButton!.trigger('click')
expect(mockAppStore.reloadClient).toHaveBeenCalledTimes(1)
})
it('uses short group labels and keeps group folding active when collapsed', async () => {
mockAppStore.sidebarCollapsed = true
const wrapper = mount(AppSidebar, {
global: {
stubs: {
ProfileSelector: true,
ModelSelector: true,
LanguageSwitch: true,
ThemeSwitch: true,
NButton: true,
},
},
})
expect(wrapper.classes()).toContain('collapsed')
expect(wrapper.findAll('.nav-group-label span').map(node => node.text())).toEqual([
'sidebar.groupConversationShort',
'sidebar.groupAgentShort',
'sidebar.groupMonitoringShort',
'sidebar.groupSystemShort',
])
const agentGroup = wrapper.findAll('.nav-group')[1]
expect(agentGroup.find('.nav-group-items').attributes('style')).toBeUndefined()
await agentGroup.find('.nav-group-label').trigger('click')
expect(agentGroup.find('.nav-group-items').attributes('style')).toContain('display: none')
})
})