优化优化
This commit is contained in:
@@ -105,4 +105,17 @@ describe('AdminSidebarMenu', () => {
|
||||
expect(wrapper.findAll('[data-kind="group"]')).toHaveLength(2)
|
||||
expect(wrapper.get('[data-kind="item"]').attributes('data-index')).toBe('/tracking')
|
||||
})
|
||||
|
||||
it('recreates the menu when asynchronously loaded groups change', async () => {
|
||||
const wrapper = mount(AdminSidebarMenu, {
|
||||
props: { items: [adminNavigation[0]], activePath: '/dashboard', collapsed: false },
|
||||
global: { stubs },
|
||||
})
|
||||
const initialMenu = wrapper.get('nav').element
|
||||
|
||||
await wrapper.setProps({ items: visibleNavigation })
|
||||
|
||||
expect(wrapper.get('nav').element).not.toBe(initialMenu)
|
||||
expect(wrapper.text()).toContain('系统管理')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user