diff --git a/src/components/NotificationProvider/NotificationProvider.test.tsx b/src/components/NotificationProvider/NotificationProvider.test.tsx index cb19c1588..88b5fe544 100644 --- a/src/components/NotificationProvider/NotificationProvider.test.tsx +++ b/src/components/NotificationProvider/NotificationProvider.test.tsx @@ -16,7 +16,7 @@ describe("NotificationProvider", () => { const TriggerComponent = () => { const notify = useNotify(); - const handleSuccess = () => notify.success("My success!"); + const handleSuccess = () => notify.success("My success!", "Test success"); const handleClear = () => notify.clear(); const handleInfo = () => notify.info("Some more details", "Test info"); const handleError = () => diff --git a/src/components/NotificationProvider/NotificationProvider.tsx b/src/components/NotificationProvider/NotificationProvider.tsx index 4bce0070c..ac193c00d 100644 --- a/src/components/NotificationProvider/NotificationProvider.tsx +++ b/src/components/NotificationProvider/NotificationProvider.tsx @@ -59,7 +59,7 @@ export const NotificationProvider: FC = ({ failure: (title, error, message, actions) => setDeduplicated(failure(title, error, message, actions)), info: (message, title) => setDeduplicated(info(message, title)), - success: (message) => setDeduplicated(success(message)), + success: (message, title) => setDeduplicated(success(message, title)), setDeduplicated, }; diff --git a/src/components/NotificationProvider/__snapshots__/NotificationProvider.test.tsx.snap b/src/components/NotificationProvider/__snapshots__/NotificationProvider.test.tsx.snap index 59418066b..0b605b549 100644 --- a/src/components/NotificationProvider/__snapshots__/NotificationProvider.test.tsx.snap +++ b/src/components/NotificationProvider/__snapshots__/NotificationProvider.test.tsx.snap @@ -15,7 +15,7 @@ exports[`NotificationProvider stores and renders notifications 1`] = ` class="p-notification__title" data-testid="notification-title" > - Success + Test success

{ }; }; -export const success = (message: ReactNode): NotificationType => { +export const success = ( + message: ReactNode, + title?: string +): NotificationType => { return { message, + title, type: NotificationSeverity.POSITIVE, }; }; diff --git a/src/components/NotificationProvider/types.ts b/src/components/NotificationProvider/types.ts index dcedf7ffc..9b3bee529 100644 --- a/src/components/NotificationProvider/types.ts +++ b/src/components/NotificationProvider/types.ts @@ -39,7 +39,7 @@ export interface NotificationHelper { actions?: NotificationAction[] ) => NotificationType; info: (message: ReactNode, title?: string) => NotificationType; - success: (message: ReactNode) => NotificationType; + success: (message: ReactNode, title?: string) => NotificationType; queue: (notification: NotificationType) => QueuedNotification; setDeduplicated: (value: NotificationType) => NotificationType; }