@@ -187,14 +187,14 @@ describe('Menu', () => {
187187 await asyncExpect ( ( ) => {
188188 expect ( $$ ( '.ant-menu-sub' ) [ 0 ] . style . display ) . not . toBe ( 'none' ) ;
189189 } , 0 ) ;
190- // openKeys.value = [];
191- // await asyncExpect(() => {
192- // expect($$('.ant-menu-sub')[0].style.display).toBe('none');
193- // }, 100);
194- // wrapper.setProps({ openKeys: ['1'] }) ;
195- // await asyncExpect(() => {
196- // expect($$('.ant-menu-sub')[0].style.display).not.toBe('none');
197- // }, 0 );
190+ openKeys . value = [ ] ;
191+ await asyncExpect ( ( ) => {
192+ expect ( $$ ( '.ant-menu-sub' ) [ 0 ] . style . display ) . toBe ( 'none' ) ;
193+ } , 100 ) ;
194+ openKeys . value = [ '1' ] ;
195+ await asyncExpect ( ( ) => {
196+ expect ( $$ ( '.ant-menu-sub' ) [ 0 ] . style . display ) . not . toBe ( 'none' ) ;
197+ } , 100 ) ;
198198 } ) ;
199199
200200 it ( 'vertical' , async ( ) => {
@@ -376,69 +376,69 @@ describe('Menu', () => {
376376 { attachTo : 'body' , sync : false } ,
377377 ) ;
378378 await asyncExpect ( ( ) => {
379- expect ( wrapper . findAll ( '.ant-menu-sub' ) . length ) . toBe ( 0 ) ;
379+ expect ( wrapper . findAll ( '.ant-menu-sub' ) . length ) . toBe ( 1 ) ;
380380 } ) ;
381381 wrapper . setProps ( { inlineCollapsed : true } ) ;
382- await asyncExpect ( ( ) => {
383- // 动画完成后的回调
384- wrapper . vm . $refs . menu . switchModeFromInline = false ;
385- wrapper . vm . $forceUpdate ( ) ;
386- } ) ;
387382 // await asyncExpect(() => {
388- // wrapper.trigger('transitionend', { propertyName: 'width' });
383+ // // 动画完成后的回调
384+ // wrapper.vm.$refs.menu.switchModeFromInline = false;
385+ // wrapper.vm.$forceUpdate();
389386 // });
390387 // await asyncExpect(() => {
391- // $$('.ant-menu-submenu-title')[0].dispatchEvent(new MouseEvent('mouseenter') );
388+ // wrapper.trigger('transitionend', { propertyName: 'width' } );
392389 // });
393- // await asyncExpect(() => {
394- // expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain(
395- // 'ant-menu-submenu-vertical',
396- // );
397- // expect(wrapper.findAll('.ant-menu-submenu')[0].classes()).toContain('ant-menu-submenu-open');
398- // expect($$('ul.ant-menu-sub')[0].className).toContain('ant-menu-vertical');
399- // expect($$('ul.ant-menu-sub')[0].style.display).not.toBe('none');
400- // }, 500);
390+ await asyncExpect ( ( ) => {
391+ $$ ( '.ant-menu-submenu-title' ) [ 0 ] . dispatchEvent ( new MouseEvent ( 'mouseenter' ) ) ;
392+ } ) ;
393+ await asyncExpect ( ( ) => {
394+ expect ( wrapper . findAll ( '.ant-menu-submenu' ) [ 0 ] . classes ( ) ) . toContain (
395+ 'ant-menu-submenu-vertical' ,
396+ ) ;
397+ expect ( wrapper . findAll ( '.ant-menu-submenu' ) [ 0 ] . classes ( ) ) . toContain ( 'ant-menu-submenu-open' ) ;
398+ expect ( $$ ( 'ul.ant-menu-sub' ) [ 0 ] . className ) . toContain ( 'ant-menu-vertical' ) ;
399+ expect ( $$ ( 'ul.ant-menu-sub' ) [ 0 ] . style . display ) . not . toBe ( 'none' ) ;
400+ } , 500 ) ;
401401 } ) ;
402402
403403 // describe('open submenu when click submenu title', () => {
404404 // beforeEach(() => {
405405 // document.body.innerHTML = '';
406406 // });
407407
408- // const toggleMenu = (wrapper, index, event) => {
409- // wrapper.findAll('.ant-menu-submenu-title')[index].trigger(event);
410- // };
408+ const toggleMenu = ( wrapper , index , event ) => {
409+ wrapper . findAll ( '.ant-menu-submenu-title' ) [ index ] . trigger ( event ) ;
410+ } ;
411411
412- // it('inline', async () => {
413- // const wrapper = mount(
414- // {
415- // render() {
416- // return (
417- // <Menu mode="inline">
418- // <SubMenu key="1" title="submenu1">
419- // <Menu.Item key="submenu1">Option 1</Menu.Item>
420- // <Menu.Item key="submenu2">Option 2</Menu.Item>
421- // </SubMenu>
422- // <Menu.Item key="2">menu2</Menu.Item>
423- // </Menu>
424- // );
425- // },
426- // },
427- // { attachTo: 'body', sync: false },
428- // );
429- // await asyncExpect(() => {
430- // expect($$('.ant-menu-sub').length).toBe(0 );
431- // toggleMenu(wrapper, 0, 'click');
432- // }, 0);
433- // await asyncExpect(() => {
434- // expect($$('.ant-menu-sub').length).toBe(1);
435- // expect($$('.ant-menu-sub')[0].style.display).not.toBe('none');
436- // toggleMenu(wrapper, 0, 'click');
437- // }, 500);
438- // await asyncExpect(() => {
439- // expect($$('.ant-menu-sub')[0].style.display).toBe('none');
440- // }, 500);
441- // });
412+ it ( 'inline' , async ( ) => {
413+ const wrapper = mount (
414+ {
415+ render ( ) {
416+ return (
417+ < Menu mode = "inline" >
418+ < SubMenu key = "1" title = "submenu1" >
419+ < Menu . Item key = "submenu1" > Option 1</ Menu . Item >
420+ < Menu . Item key = "submenu2" > Option 2</ Menu . Item >
421+ </ SubMenu >
422+ < Menu . Item key = "2" > menu2</ Menu . Item >
423+ </ Menu >
424+ ) ;
425+ } ,
426+ } ,
427+ { attachTo : 'body' , sync : false } ,
428+ ) ;
429+ await asyncExpect ( ( ) => {
430+ expect ( $$ ( '.ant-menu-sub' ) . length ) . toBe ( 1 ) ;
431+ toggleMenu ( wrapper , 0 , 'click' ) ;
432+ } , 0 ) ;
433+ await asyncExpect ( ( ) => {
434+ expect ( $$ ( '.ant-menu-sub' ) . length ) . toBe ( 1 ) ;
435+ expect ( $$ ( '.ant-menu-sub' ) [ 0 ] . style . display ) . not . toBe ( 'none' ) ;
436+ toggleMenu ( wrapper , 0 , 'click' ) ;
437+ } , 500 ) ;
438+ await asyncExpect ( ( ) => {
439+ expect ( $$ ( '.ant-menu-sub' ) [ 0 ] . style . display ) . toBe ( 'none' ) ;
440+ } , 500 ) ;
441+ } ) ;
442442
443443 // it('vertical', async () => {
444444 // const wrapper = mount(
0 commit comments