[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:
Vito
2019-08-13 15:13:21 +01:00
committed by GitHub
parent 9ca61975a5
commit 9873e9952a
3 changed files with 32 additions and 9 deletions

View File

@@ -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(() => {