mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +00:00
[ADF-4811] - added extra method to open snackbar with interpolate arg… (#4989)
* [ADF-4811] - added extra method to open snackbar with interpolate args for translated messages * [ADF-4811] - added extra parameter to show info * [ADF-4811] - added extra parameter to show info * [ADF-4811] added review changes
This commit is contained in:
@@ -45,6 +45,10 @@ class ProvidesNotificationServiceComponent {
|
||||
return this.notificationService.openSnackMessage('Test notification', 1000);
|
||||
}
|
||||
|
||||
sendMessageWithArgs() {
|
||||
return this.notificationService.openSnackMessage('Test notification {{ arg }}', 1000, {arg: 'arg'});
|
||||
}
|
||||
|
||||
sendCustomMessage() {
|
||||
const matSnackBarConfig = new MatSnackBarConfig();
|
||||
matSnackBarConfig.duration = 1000;
|
||||
@@ -108,6 +112,18 @@ describe('NotificationService', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should translate messages with args', (done) => {
|
||||
spyOn(translationService, 'instant').and.callThrough();
|
||||
|
||||
const promise = fixture.componentInstance.sendMessageWithArgs();
|
||||
promise.afterDismissed().subscribe(() => {
|
||||
expect(translationService.instant).toHaveBeenCalledWith('Test notification {{ arg }}', {arg: 'arg'});
|
||||
done();
|
||||
});
|
||||
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should open a message notification bar', (done) => {
|
||||
const promise = fixture.componentInstance.sendMessage();
|
||||
promise.afterDismissed().subscribe(() => {
|
||||
|
Reference in New Issue
Block a user