diff --git a/services/web/frontend/js/shared/components/notification.tsx b/services/web/frontend/js/shared/components/notification.tsx index aa36ff8940..25a28a2f29 100644 --- a/services/web/frontend/js/shared/components/notification.tsx +++ b/services/web/frontend/js/shared/components/notification.tsx @@ -8,7 +8,7 @@ type NotificationType = 'info' | 'success' | 'warning' | 'error' type NotificationProps = { action?: React.ReactElement ariaLive?: 'polite' | 'off' | 'assertive' - content: React.ReactElement + content: React.ReactElement | string customIcon?: React.ReactElement isDismissible?: boolean isActionBelowContent?: boolean diff --git a/services/web/frontend/stories/notification.stories.tsx b/services/web/frontend/stories/notification.stories.tsx index e761da39c5..cf486fcfaa 100644 --- a/services/web/frontend/stories/notification.stories.tsx +++ b/services/web/frontend/stories/notification.stories.tsx @@ -300,6 +300,10 @@ export const SuccessFlow = (args: Args) => { return startNotification } +export const ContentAsAString = (args: Args) => { + return +} + export default { title: 'Shared / Components / Notification', component: Notification, diff --git a/services/web/test/frontend/shared/components/notification.test.tsx b/services/web/test/frontend/shared/components/notification.test.tsx index d7f8077271..a4b421efc6 100644 --- a/services/web/test/frontend/shared/components/notification.test.tsx +++ b/services/web/test/frontend/shared/components/notification.test.tsx @@ -41,7 +41,7 @@ describe('', function () { screen.getByRole('button', { name: 'Close' }) }) - it('renders with title', function () { + it('renders with title and content passed as HTML', function () { render( ', function () { /> ) screen.getByText('A title') + screen.getByText('A notification') + }) + + it('renders with content when passed as a string', function () { + render( + + ) + screen.getByText('A notification') }) })