mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
* [#5561] Translate action value * Fix lint issues
This commit is contained in:
committed by
GitHub
parent
63063699fd
commit
d089283aa4
@@ -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(() => {
|
||||
|
@@ -104,10 +104,11 @@ export class NotificationService {
|
||||
|
||||
private dispatchNotification(message: string, action?: string, config?: number | MatSnackBarConfig, interpolateArgs?: any): MatSnackBarRef<any> {
|
||||
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 : {} )
|
||||
|
Reference in New Issue
Block a user