Skip to content

Commit

Permalink
fix(nav): don't emit (navChange) when activeId is not set initially (#…
Browse files Browse the repository at this point in the history
…3567)

Fixes #3564
  • Loading branch information
maxokorokov authored Feb 7, 2020
1 parent f845951 commit dd1c35d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/nav/nav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('nav', () => {
expectLinks(fixture, [true, false]);
expectContents(fixture, ['content 1']);
expect(activeIdChangeSpy).toHaveBeenCalledWith(1);
expect(navChangeSpy).toHaveBeenCalledWith({activeId: undefined, nextId: 1, preventDefault: jasmine.any(Function)});
expect(navChangeSpy).toHaveBeenCalledTimes(0);
});

it(`should initially select nothing, if [activeId] provided is incorrect`, () => {
Expand Down
2 changes: 1 addition & 1 deletion src/nav/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class NgbNav implements AfterContentInit {
if (!isDefined(this.activeId)) {
const nextId = this.items.first ? this.items.first.id : null;
if (nextId) {
this._updateActiveId(nextId);
this._updateActiveId(nextId, false);
this._cd.detectChanges();
}
}
Expand Down

0 comments on commit dd1c35d

Please sign in to comment.