File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/material-experimental/mdc-tabs/tab-nav-bar Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments