Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/material/tabs/ink-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class MatInkBar {
/** Hides the ink bar. */
hide() {
this._items.forEach(item => item.deactivateInkBar());
this._currentItem = undefined;
}

/** Aligns the ink bar to a DOM node. */
Expand Down
22 changes: 22 additions & 0 deletions src/material/tabs/tab-nav-bar/tab-nav-bar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,28 @@ describe('MatTabNavBar', () => {
expect(tabLinks[1].classList.contains('mdc-tab--active')).toBe(true);
});

it('should re-show the ink bar if the same tab is cleared and re-activated', fakeAsync(() => {
const getInkBars = () =>
fixture.nativeElement.querySelectorAll('.mdc-tab-indicator--active').length;
const fixture = TestBed.createComponent(SimpleTabNavBarTestApp);
fixture.componentInstance.activeIndex = 0;
fixture.detectChanges();
tick(20);
expect(getInkBars()).toBe(1);

fixture.componentInstance.activeIndex = -1;
fixture.changeDetectorRef.markForCheck();
fixture.detectChanges();
tick(20);
expect(getInkBars()).toBe(0);

fixture.componentInstance.activeIndex = 0;
fixture.changeDetectorRef.markForCheck();
fixture.detectChanges();
tick(20);
expect(getInkBars()).toBe(1);
}));

describe('ripples', () => {
let fixture: ComponentFixture<SimpleTabNavBarTestApp>;

Expand Down
Loading