This commit is contained in:
2026-08-03 11:45:45 +08:00
parent 9fe5428c44
commit bc44a7942d
33 changed files with 555 additions and 86 deletions
+13 -18
View File
@@ -19,29 +19,23 @@ const stubs = {
}
describe('AdminSidebarMenu', () => {
it('renders grouped page entries and forwards the active route', () => {
it('renders the visible phase-one modules and forwards the active route', () => {
const wrapper = mount(AdminSidebarMenu, {
props: { items: adminNavigation, activePath: '/system/users', collapsed: false },
global: { stubs },
})
expect(wrapper.get('nav').attributes('data-active')).toBe('/system/users')
expect(wrapper.findAll('[data-kind="group"] header').map((node) => node.text())).toEqual([
'业务管理',
'基础资料',
'系统管理',
])
expect(wrapper.findAll('[data-kind="item"]').map((node) => node.attributes('data-index'))).toEqual([
'/customers',
'/customers/reviews',
'/warehouses',
'/orders/first-leg',
'/master-data/express-companies',
'/master-data/counterparties',
'/system/users',
'/system/roles',
'/system/permissions',
])
const groupTitles = wrapper.findAll('[data-kind="group"] header').map((node) => node.text())
const paths = wrapper.findAll('[data-kind="item"]').map((node) => node.attributes('data-index'))
expect(groupTitles).toContain('客户管理')
expect(groupTitles).toContain('系统管理')
expect(groupTitles).not.toContain('财务管理')
expect(paths).not.toContain('/dashboard')
expect(paths).toContain('/orders/first-leg')
expect(paths).not.toContain('/prototype/reports/overview')
expect(paths).toContain('/system/permissions')
})
it('forwards desktop collapse state to Element Plus', () => {
@@ -61,7 +55,8 @@ describe('AdminSidebarMenu', () => {
})
expect(wrapper.text()).toContain('菜单权限')
expect(wrapper.text()).not.toContain('客户管理')
expect(wrapper.text()).not.toContain('首页数据看板')
expect(wrapper.text()).not.toContain('客户列表')
})
it('recursively renders three navigation levels', () => {