1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

[FLASK] disable "Mark all as read button" when there are no notifications (#15333)

* [Flask] disable "Mark all as read button" when there are no notifications

* Adding test case

* Addressing feedback
This commit is contained in:
ryanml 2022-07-27 09:49:34 -07:00 committed by GitHub
parent e12d0a94e8
commit c677edc51d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -64,9 +64,10 @@ describe('Notifications', () => {
}, },
}; };
const { getByText } = render(mockStore); const { getByText, getByRole } = render(mockStore);
expect(getByText('Nothing to see here.')).toBeDefined(); expect(getByText('Nothing to see here.')).toBeDefined();
expect(getByRole('button', { name: 'Mark all as read' })).toBeDisabled();
}); });
}); });

View File

@ -99,6 +99,7 @@ export default function Notifications() {
type="secondary" type="secondary"
className="notifications__header_button" className="notifications__header_button"
onClick={markAllAsRead} onClick={markAllAsRead}
disabled={unreadNotifications.length === 0}
> >
{t('notificationsMarkAllAsRead')} {t('notificationsMarkAllAsRead')}
</Button> </Button>