fix title translation (#3565)

This commit is contained in:
Denys Vuika
2018-07-06 10:01:43 +01:00
committed by Eugenio Romano
parent f298e78392
commit 75e27ccb36
2 changed files with 13 additions and 0 deletions

View File

@@ -75,4 +75,16 @@ describe('AppTitle service', () => {
translationService.translate.onLangChange.next(<any> {}); translationService.translate.onLangChange.next(<any> {});
expect(titleServiceSpy).toHaveBeenCalledWith('привет - My application'); expect(titleServiceSpy).toHaveBeenCalledWith('привет - My application');
}); });
it('should update title on new content download', () => {
spyOn(translationService, 'instant').and.returnValues('hello', 'привет');
pageTitleService.setTitle('key');
expect(titleServiceSpy).toHaveBeenCalledWith('hello - My application');
(<any> titleService).setTitle.calls.reset();
translationService.translate.onTranslationChange.next(<any> {});
expect(titleServiceSpy).toHaveBeenCalledWith('привет - My application');
});
}); });

View File

@@ -31,6 +31,7 @@ export class PageTitleService {
private appConfig: AppConfigService, private appConfig: AppConfigService,
private translationService: TranslationService) { private translationService: TranslationService) {
translationService.translate.onLangChange.subscribe(() => this.onLanguageChanged()); translationService.translate.onLangChange.subscribe(() => this.onLanguageChanged());
translationService.translate.onTranslationChange.subscribe(() => this.onLanguageChanged());
} }
/** /**