diff --git a/src/NotificationList/index.tsx b/src/NotificationList/index.tsx index d0ff04b3..62bba2e5 100644 --- a/src/NotificationList/index.tsx +++ b/src/NotificationList/index.tsx @@ -248,12 +248,6 @@ const NotificationList: React.FC = (props) => { [`${listPrefixCls}-hovered`]: listHovering, }, )} - onMouseEnter={() => { - setListHovering(true); - }} - onMouseLeave={() => { - setListHovering(false); - }} style={{ ...styles?.list, ...style }} > = (props) => { className={classNames?.listContent} style={styles?.listContent} ref={contentRef} + onMouseEnter={() => { + setListHovering(true); + }} + onMouseLeave={() => { + setListHovering(false); + }} > { it('support stack', () => { @@ -41,6 +41,9 @@ describe('stack', () => { expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); fireEvent.mouseEnter(document.querySelector('.rc-notification-list')); + expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); + + fireEvent.mouseEnter(document.querySelector('.rc-notification-list-content')); expect(document.querySelector('.rc-notification-stack-expanded')).toBeTruthy(); }); @@ -74,14 +77,14 @@ describe('stack', () => { expect(document.querySelector('.rc-notification-stack')).toBeTruthy(); expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); - fireEvent.mouseEnter(document.querySelector('.rc-notification-list')); + fireEvent.mouseEnter(document.querySelector('.rc-notification-list-content')); expect(document.querySelector('.rc-notification-stack-expanded')).toBeTruthy(); fireEvent.click(document.querySelector('.rc-notification-notice-close')); expect(document.querySelectorAll('.rc-notification-notice')).toHaveLength(4); expect(document.querySelector('.rc-notification-stack-expanded')).toBeTruthy(); - fireEvent.mouseLeave(document.querySelector('.rc-notification-list')); + fireEvent.mouseLeave(document.querySelector('.rc-notification-list-content')); expect(document.querySelector('.rc-notification-stack-expanded')).toBeFalsy(); }); });