Skip to content

Commit 46a8ccb

Browse files
committed
test(material-experimental/mdc-tabs): add missing test coverage
Adds tests that were missing from the `mdc-tabs` module.
1 parent deb158d commit 46a8ccb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/material-experimental/mdc-tabs/tab-nav-bar/tab-nav-bar.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,22 @@ describe('MDC-based MatTabNavBar', () => {
260260
expect(tabLink.tabIndex).toBe(3, 'Expected the tabIndex to be have been set to 3.');
261261
});
262262

263+
it('should select the proper tab, if the tabs come in after init', () => {
264+
const fixture = TestBed.createComponent(SimpleTabNavBarTestApp);
265+
const instance = fixture.componentInstance;
266+
267+
instance.tabs = [];
268+
instance.activeIndex = 1;
269+
fixture.detectChanges();
270+
271+
expect(instance.tabNavBar.selectedIndex).toBe(-1);
272+
273+
instance.tabs = [0, 1, 2];
274+
fixture.detectChanges();
275+
276+
expect(instance.tabNavBar.selectedIndex).toBe(1);
277+
});
278+
263279
describe('ripples', () => {
264280
let fixture: ComponentFixture<SimpleTabNavBarTestApp>;
265281

0 commit comments

Comments
 (0)