File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -300,7 +300,10 @@ const InternalSubMenu = (props: SubMenuProps) => {
300300 popupClassName = { popupClassName }
301301 popupOffset = { popupOffset }
302302 popup = {
303- < MenuContextProvider mode = { triggerMode } >
303+ < MenuContextProvider
304+ // Special handle of horizontal mode
305+ mode = { triggerMode === 'horizontal' ? 'vertical' : triggerMode }
306+ >
304307 < SubMenuList id = { popupId } ref = { popupRef } >
305308 { children }
306309 </ SubMenuList >
Original file line number Diff line number Diff line change @@ -407,5 +407,37 @@ describe('SubMenu', () => {
407407 wrapper . find ( 'div.rc-menu-submenu-title' ) . last ( ) . simulate ( 'click' ) ;
408408 expect ( onOpenChange ) . toHaveBeenCalledWith ( [ 'light' ] ) ;
409409 } ) ;
410+
411+ it ( 'popup className should correct' , ( ) => {
412+ jest . useFakeTimers ( ) ;
413+
414+ const wrapper = mount (
415+ < Menu mode = "horizontal" openKeys = { [ 'light' ] } disabledOverflow >
416+ < SubMenu key = "light" >
417+ < SubMenu key = "bamboo" />
418+ </ SubMenu >
419+ </ Menu > ,
420+ ) ;
421+
422+ act ( ( ) => {
423+ jest . runAllTimers ( ) ;
424+ wrapper . update ( ) ;
425+ } ) ;
426+
427+ expect (
428+ wrapper
429+ . find ( 'li.rc-menu-submenu' )
430+ . first ( )
431+ . hasClass ( 'rc-menu-submenu-horizontal' ) ,
432+ ) . toBeTruthy ( ) ;
433+ expect (
434+ wrapper
435+ . find ( 'li.rc-menu-submenu' )
436+ . last ( )
437+ . hasClass ( 'rc-menu-submenu-vertical' ) ,
438+ ) . toBeTruthy ( ) ;
439+
440+ jest . useRealTimers ( ) ;
441+ } ) ;
410442} ) ;
411443/* eslint-enable */
You can’t perform that action at this time.
0 commit comments