File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,9 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
7676 const placementMotion = typeof motion === 'function' ? motion ( placement ) : motion ;
7777 const [ stackEnabled , { offset, threshold } ] = useStack ( stackConfig ) ;
7878 const [ listHovering , setListHovering ] = React . useState ( false ) ;
79+ const stackCollapsed = stackEnabled && keys . length > threshold ;
7980 const expanded = stackEnabled && ( listHovering || keys . length <= threshold ) ;
81+ const stackExpanded = stackCollapsed && listHovering ;
8082 const stackPosition = React . useMemo < StackConfig | undefined > ( ( ) => {
8183 if ( ! stackEnabled || expanded ) {
8284 return undefined ;
@@ -123,7 +125,7 @@ const NotificationList: React.FC<NotificationListProps> = (props) => {
123125 className ,
124126 {
125127 [ `${ prefixCls } -stack` ] : stackEnabled ,
126- [ `${ prefixCls } -stack-expanded` ] : expanded ,
128+ [ `${ prefixCls } -stack-expanded` ] : stackExpanded ,
127129 } ,
128130 ) }
129131 onMouseEnter = { ( ) => {
Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ describe('stack', () => {
3333 }
3434 expect ( document . querySelectorAll ( '.rc-notification-notice' ) ) . toHaveLength ( 3 ) ;
3535 expect ( document . querySelector ( '.rc-notification-stack' ) ) . toBeTruthy ( ) ;
36- expect ( document . querySelector ( '.rc-notification-stack-expanded' ) ) . toBeTruthy ( ) ;
36+ expect ( document . querySelector ( '.rc-notification-stack-expanded' ) ) . toBeFalsy ( ) ;
37+
38+ fireEvent . mouseEnter ( document . querySelector ( '.rc-notification-list' ) ) ;
39+ expect ( document . querySelector ( '.rc-notification-stack-expanded' ) ) . toBeFalsy ( ) ;
40+ fireEvent . mouseLeave ( document . querySelector ( '.rc-notification-list' ) ) ;
3741
3842 for ( let i = 0 ; i < 2 ; i ++ ) {
3943 fireEvent . click ( container . querySelector ( 'button' ) ) ;
You can’t perform that action at this time.
0 commit comments