fix: 将侧栏提示层移到导航外侧

将桌面折叠侧栏的 NPopover 显式挂载到 body,并把提示框完整偏移到 64px 导航边界之外。
This commit is contained in:
GouJ
2026-09-09 10:49:10 +08:00
committed by GitHub
parent c2639ca7af
commit 826e3bfa0f
3 changed files with 58 additions and 28 deletions
+14 -1
View File
@@ -178,7 +178,19 @@ describe('管理后台组件边界', () => {
expect(wrapper.find('[aria-label="展开侧栏"]').exists()).toBe(true)
expect(wrapper.getComponent(NMenu).props('collapsed')).toBe(false)
expect(firstMenuIcon().type).toBe(NPopover)
expect(wrapper.get('.admin-sider-footer').getComponent(NPopover).props('disabled')).toBe(false)
expect(firstMenuIcon().props).toMatchObject({
placement: 'right',
to: 'body',
class: 'admin-nav-popover',
zIndex: 3000
})
const footerPopover = wrapper.get('.admin-sider-footer').getComponent(NPopover)
expect(footerPopover.props()).toMatchObject({
disabled: false,
placement: 'right',
to: 'body',
zIndex: 3000
})
const settings = wrapper.get('.admin-sider-footer [aria-label="后端连接"]')
expect(settings.text()).toBe('后端连接')
await settings.trigger('click')
@@ -195,6 +207,7 @@ describe('管理后台组件边界', () => {
)
expect(css).toMatch(/\.admin-sider\.is-collapsed \.n-menu-item-content-header\s*\{[^}]*opacity:\s*0/)
expect(css).toMatch(/\.admin-sider\.is-collapsed \.n-menu-item-content__icon\s*\{[^}]*z-index:\s*2/)
expect(css).toMatch(/\.n-popover\.admin-nav-popover\s*\{[^}]*margin-inline-start:\s*24px\s*!important/)
expect(css).toMatch(/\.admin-sider-footer\s*\{[^}]*flex-shrink:\s*0/)
expect(css).toMatch(/\.admin-sider\.is-collapsed \.admin-settings-label\s*\{[^}]*opacity:\s*0/)
expect(css).toMatch(/\.admin-sider\.is-collapsed \.admin-brand span\s*\{[^}]*opacity:\s*0/)