Skip to content

Commit

Permalink
fix(theme:title): fix ignore empty title (#1638)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk authored Aug 5, 2023
1 parent d815dbd commit c7bf339
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/theme/src/services/title/title.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ describe('Service: Title', () => {
expect(title.setTitle).toHaveBeenCalledWith(`${notPageName} - ${alain}`);
}));

it('should be ignore when empty title & default title', fakeAsync(() => {
srv.default = '';
srv.suffix = alain;
srv.setTitle();
tick(srv.DELAY_TIME + 1);
expect(title.setTitle).toHaveBeenCalledWith(`${alain}`);
}));

it('should set new title', fakeAsync(() => {
srv.suffix = alain;
srv.setTitle('newTitle');
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/services/title/title.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class TitleService implements OnDestroy {
if (this._prefix) {
newTitles.push(this._prefix);
}
newTitles.push(...(titles as string[]));
newTitles.push(...titles.filter(title => !!title));
if (this._suffix) {
newTitles.push(this._suffix);
}
Expand Down

0 comments on commit c7bf339

Please sign in to comment.