Merge pull request #1254 from sbenmoussati/SDA-3292

SDA-3292 Close button hovering fix
This commit is contained in:
Salah Benmoussati 2021-08-13 16:27:13 +02:00 committed by GitHub
commit 816d2efa88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -128,4 +128,14 @@ describe('Toast notification component', () => {
toastNotificationReplyButton = wrapper.find(replyButtonSelector);
expect(toastNotificationReplyButton.exists()).toBeTruthy();
});
it('should trigger mouse hovering function while hovering a notification', async () => {
const spy = jest.spyOn(ipcRenderer, 'send');
const notificationContainer = wrapper.find(
'[data-testid="NOTIFICATION_CONTAINER"]',
);
expect(notificationContainer).toBeTruthy();
notificationContainer.simulate('mouseenter');
expect(spy).toBeCalledWith('notification-mouseenter', 0);
});
});

View File

@ -157,6 +157,7 @@ export default class NotificationComp extends React.Component<
containerCssClass += customCssClasses.join(' ');
return (
<div
data-testid='NOTIFICATION_CONTAINER'
className={containerCssClass}
style={{
height: containerHeight,
@ -164,6 +165,8 @@ export default class NotificationComp extends React.Component<
borderColor: themeColors.notificationBorderColor,
}}
lang={i18n.getLocale()}
onMouseEnter={this.eventHandlers.onMouseEnter(id)}
onMouseLeave={this.eventHandlers.onMouseLeave(id)}
>
<div
className={`close-button ${themeClassName}`}
@ -181,8 +184,6 @@ export default class NotificationComp extends React.Component<
role='alert'
onContextMenu={this.eventHandlers.onContextMenu}
onClick={this.eventHandlers.onClick(id)}
onMouseEnter={this.eventHandlers.onMouseEnter(id)}
onMouseLeave={this.eventHandlers.onMouseLeave(id)}
>
<div className='logo-container'>{this.renderImage(icon)}</div>
<div className='notification-container'>