diff --git a/lib/core/notifications/services/notification.service.spec.ts b/lib/core/notifications/services/notification.service.spec.ts index 70d1b8df25..1a393da20b 100644 --- a/lib/core/notifications/services/notification.service.spec.ts +++ b/lib/core/notifications/services/notification.service.spec.ts @@ -124,6 +124,18 @@ describe('NotificationService', () => { fixture.detectChanges(); }); + it('should translate the action', (done) => { + spyOn(translationService, 'instant').and.callThrough(); + + const promise = fixture.componentInstance.sendMessageAction(); + promise.afterDismissed().subscribe(() => { + expect(translationService.instant).toHaveBeenCalledTimes(2); + done(); + }); + + fixture.detectChanges(); + }); + it('should open a message notification bar', (done) => { const promise = fixture.componentInstance.sendMessage(); promise.afterDismissed().subscribe(() => { diff --git a/lib/core/notifications/services/notification.service.ts b/lib/core/notifications/services/notification.service.ts index 77be38b91e..29b475f579 100644 --- a/lib/core/notifications/services/notification.service.ts +++ b/lib/core/notifications/services/notification.service.ts @@ -104,10 +104,11 @@ export class NotificationService { private dispatchNotification(message: string, action?: string, config?: number | MatSnackBarConfig, interpolateArgs?: any): MatSnackBarRef { const translatedMessage: string = this.translationService.instant(message, interpolateArgs); + const translatedAction: string = this.translationService.instant(action, interpolateArgs); const createNotification = this.getNotificationCreator(config); this.notifications$.next(createNotification(translatedMessage)); - return this.snackBar.open(translatedMessage, action, { + return this.snackBar.open(translatedMessage, translatedAction, { duration: (typeof config === 'number') ? config : this.DEFAULT_DURATION_MESSAGE, panelClass: INFO_SNACK_CLASS, ...( (typeof config === 'object') ? config : {} )