File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ export class MatInkBar {
4848 /** Hides the ink bar. */
4949 hide ( ) {
5050 this . _items . forEach ( item => item . deactivateInkBar ( ) ) ;
51+ this . _currentItem = undefined ;
5152 }
5253
5354 /** Aligns the ink bar to a DOM node. */
Original file line number Diff line number Diff line change @@ -357,6 +357,28 @@ describe('MatTabNavBar', () => {
357357 expect ( tabLinks [ 1 ] . classList . contains ( 'mdc-tab--active' ) ) . toBe ( true ) ;
358358 } ) ;
359359
360+ it ( 'should re-show the ink bar if the same tab is cleared and re-activated' , fakeAsync ( ( ) => {
361+ const getInkBars = ( ) =>
362+ fixture . nativeElement . querySelectorAll ( '.mdc-tab-indicator--active' ) . length ;
363+ const fixture = TestBed . createComponent ( SimpleTabNavBarTestApp ) ;
364+ fixture . componentInstance . activeIndex = 0 ;
365+ fixture . detectChanges ( ) ;
366+ tick ( 20 ) ;
367+ expect ( getInkBars ( ) ) . toBe ( 1 ) ;
368+
369+ fixture . componentInstance . activeIndex = - 1 ;
370+ fixture . changeDetectorRef . markForCheck ( ) ;
371+ fixture . detectChanges ( ) ;
372+ tick ( 20 ) ;
373+ expect ( getInkBars ( ) ) . toBe ( 0 ) ;
374+
375+ fixture . componentInstance . activeIndex = 0 ;
376+ fixture . changeDetectorRef . markForCheck ( ) ;
377+ fixture . detectChanges ( ) ;
378+ tick ( 20 ) ;
379+ expect ( getInkBars ( ) ) . toBe ( 1 ) ;
380+ } ) ) ;
381+
360382 describe ( 'ripples' , ( ) => {
361383 let fixture : ComponentFixture < SimpleTabNavBarTestApp > ;
362384
You can’t perform that action at this time.
0 commit comments