File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ export class MatInkBar {
48
48
/** Hides the ink bar. */
49
49
hide ( ) {
50
50
this . _items . forEach ( item => item . deactivateInkBar ( ) ) ;
51
+ this . _currentItem = undefined ;
51
52
}
52
53
53
54
/** Aligns the ink bar to a DOM node. */
Original file line number Diff line number Diff line change @@ -357,6 +357,28 @@ describe('MatTabNavBar', () => {
357
357
expect ( tabLinks [ 1 ] . classList . contains ( 'mdc-tab--active' ) ) . toBe ( true ) ;
358
358
} ) ;
359
359
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
+
360
382
describe ( 'ripples' , ( ) => {
361
383
let fixture : ComponentFixture < SimpleTabNavBarTestApp > ;
362
384
You can’t perform that action at this time.
0 commit comments