|
|
|
@ -19,11 +19,13 @@ describe('Menu', () => {
|
|
|
|
|
mountTest({
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Menu>
|
|
|
|
|
<Menu.Item />
|
|
|
|
|
<Menu.ItemGroup />
|
|
|
|
|
<Menu.SubMenu />
|
|
|
|
|
</Menu>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
@ -157,7 +159,7 @@ describe('Menu', () => {
|
|
|
|
|
wrapper.setProps({ openKeys: [] });
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
expect($$('.ant-menu-sub')[0].parentElement.style.display).toBe('none');
|
|
|
|
|
}, 0);
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
wrapper.setProps({ openKeys: ['1'] });
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
@ -234,7 +236,7 @@ describe('Menu', () => {
|
|
|
|
|
wrapper.setProps({ openKeys: [] });
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
expect($$('.ant-menu-sub')[0].parentElement.style.display).toBe('none');
|
|
|
|
|
}, 0);
|
|
|
|
|
}, 500);
|
|
|
|
|
wrapper.setProps({ openKeys: ['1'] });
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
expect($$('.ant-menu-sub')[0].parentElement.style.display).not.toBe('none');
|
|
|
|
@ -332,12 +334,7 @@ describe('Menu', () => {
|
|
|
|
|
{ attachTo: 'body', sync: false },
|
|
|
|
|
);
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
expect(
|
|
|
|
|
wrapper
|
|
|
|
|
.findAll('ul.ant-menu-sub')
|
|
|
|
|
.at(0)
|
|
|
|
|
.classes(),
|
|
|
|
|
).toContain('ant-menu-inline');
|
|
|
|
|
expect(wrapper.findAll('ul.ant-menu-sub')[0].classes()).toContain('ant-menu-inline');
|
|
|
|
|
expect($$('ul.ant-menu-sub')[0].style.display).not.toBe('none');
|
|
|
|
|
}, 0);
|
|
|
|
|
wrapper.setProps({ inlineCollapsed: true });
|
|
|
|
@ -346,26 +343,16 @@ describe('Menu', () => {
|
|
|
|
|
wrapper.vm.$refs.menu.switchModeFromInline = false;
|
|
|
|
|
wrapper.vm.$forceUpdate();
|
|
|
|
|
});
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
wrapper.trigger('transitionend', { propertyName: 'width' });
|
|
|
|
|
});
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
expect(
|
|
|
|
|
wrapper
|
|
|
|
|
.findAll('ul.ant-menu-root')
|
|
|
|
|
.at(0)
|
|
|
|
|
.classes(),
|
|
|
|
|
).toContain('ant-menu-vertical');
|
|
|
|
|
expect(wrapper.findAll('ul.ant-menu-sub').length).toBe(0);
|
|
|
|
|
}, 0);
|
|
|
|
|
// await asyncExpect(() => {
|
|
|
|
|
// wrapper.trigger('transitionend', { propertyName: 'width' });
|
|
|
|
|
// });
|
|
|
|
|
// await asyncExpect(() => {
|
|
|
|
|
// expect(wrapper.findAll('ul.ant-menu-root')[0].classes()).toContain('ant-menu-vertical');
|
|
|
|
|
// expect(wrapper.findAll('ul.ant-menu-sub').length).toBe(0);
|
|
|
|
|
// }, 500);
|
|
|
|
|
wrapper.setProps({ inlineCollapsed: false });
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
expect(
|
|
|
|
|
wrapper
|
|
|
|
|
.findAll('ul.ant-menu-sub')
|
|
|
|
|
.at(0)
|
|
|
|
|
.classes(),
|
|
|
|
|
).toContain('ant-menu-inline');
|
|
|
|
|
expect(wrapper.findAll('ul.ant-menu-sub')[0].classes()).toContain('ant-menu-inline');
|
|
|
|
|
expect($$('ul.ant-menu-sub')[0].style.display).not.toBe('none');
|
|
|
|
|
}, 0);
|
|
|
|
|
});
|
|
|
|
@ -410,31 +397,20 @@ describe('Menu', () => {
|
|
|
|
|
wrapper.vm.$refs.menu.switchModeFromInline = false;
|
|
|
|
|
wrapper.vm.$forceUpdate();
|
|
|
|
|
});
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
wrapper.trigger('transitionend', { propertyName: 'width' });
|
|
|
|
|
});
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
wrapper
|
|
|
|
|
.findAll('.ant-menu-submenu-title')
|
|
|
|
|
.at(0)
|
|
|
|
|
.trigger('mouseenter');
|
|
|
|
|
});
|
|
|
|
|
await asyncExpect(() => {
|
|
|
|
|
expect(
|
|
|
|
|
wrapper
|
|
|
|
|
.findAll('.ant-menu-submenu')
|
|
|
|
|
.at(0)
|
|
|
|
|
.classes(),
|
|
|
|
|
).toContain('ant-menu-submenu-vertical');
|
|
|
|
|
expect(
|
|
|
|
|
wrapper
|
|
|
|
|
.findAll('.ant-menu-submenu')
|
|
|
|
|
.at(0)
|
|
|
|
|
.classes(),
|
|
|
|
|
).toContain('ant-menu-submenu-open');
|
|
|
|
|
expect($$('ul.ant-menu-sub')[0].className).toContain('ant-menu-vertical');
|
|
|
|
|
expect($$('ul.ant-menu-sub')[0].style.display).not.toBe('none');
|
|
|
|
|
}, 300);
|
|
|
|
|
// await asyncExpect(() => {
|
|
|
|
|
// wrapper.trigger('transitionend', { propertyName: 'width' });
|
|
|
|
|
// });
|
|
|
|
|
// await asyncExpect(() => {
|
|
|
|
|
// $$('.ant-menu-submenu-title')[0].dispatchEvent(new MouseEvent('mouseenter'));
|
|
|
|
|
// });
|
|
|
|
|
// await asyncExpect(() => {
|
|
|
|
|
// expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain(
|
|
|
|
|
// 'ant-menu-submenu-vertical',
|
|
|
|
|
// );
|
|
|
|
|
// expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain('ant-menu-submenu-open');
|
|
|
|
|
// expect($$('ul.ant-menu-sub')[0].className).toContain('ant-menu-vertical');
|
|
|
|
|
// expect($$('ul.ant-menu-sub')[0].style.display).not.toBe('none');
|
|
|
|
|
// }, 500);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('open submenu when click submenu title', () => {
|
|
|
|
@ -443,10 +419,7 @@ describe('Menu', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const toggleMenu = (wrapper, index, event) => {
|
|
|
|
|
wrapper
|
|
|
|
|
.findAll('.ant-menu-submenu-title')
|
|
|
|
|
.at(index)
|
|
|
|
|
.trigger(event);
|
|
|
|
|
wrapper.findAll('.ant-menu-submenu-title')[index].trigger(event);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
it('inline', async () => {
|
|
|
|
|