[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
feature/default_network_editable
ryanml 2 years ago committed by GitHub
parent e12d0a94e8
commit c677edc51d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ui/pages/notifications/notification.test.js
  2. 1
      ui/pages/notifications/notifications.js

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

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

Loading…
Cancel
Save