File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed
projects/igniteui-angular/src/lib/tabs Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -531,11 +531,13 @@ describe('IgxTabs', () => {
531531 } ) ;
532532
533533 describe ( 'Tabs-only Mode With Initial Selection Set on TabItems Tests' , ( ) => {
534+ let router ;
534535 let fixture ;
535536 let tabsComp ;
536537 let theTabs ;
537538
538539 beforeEach ( async ( ( ) => {
540+ router = TestBed . get ( Router ) ;
539541 fixture = TestBed . createComponent ( TabsTabsOnlyModeTest1Component ) ;
540542 tabsComp = fixture . componentInstance . tabs ;
541543 fixture . detectChanges ( ) ;
@@ -576,6 +578,17 @@ describe('IgxTabs', () => {
576578 expect ( theTabs [ 2 ] . nativeTabItem . nativeElement . classList . contains ( tabItemSelectedCssClass ) ) . toBe ( true ) ;
577579 } ) ;
578580
581+ it ( 'should clear the selection indicator when not tab item is selected' , fakeAsync ( ( ) => {
582+ fixture . ngZone . run ( ( ) => { router . initialNavigation ( ) ; } ) ;
583+ tick ( ) ;
584+ expect ( tabsComp . selectedIndicator . nativeElement . style . visibility ) . toBe ( 'visible' ) ;
585+
586+ fixture . ngZone . run ( ( ) => { router . navigate ( [ '/' ] ) ; } ) ;
587+ tick ( ) ;
588+ fixture . detectChanges ( ) ;
589+ expect ( tabsComp . selectedIndicator . nativeElement . style . visibility ) . toBe ( 'hidden' ) ;
590+ } ) ) ;
591+
579592 } ) ;
580593
581594 describe ( 'Tabs-only Mode With Initial Selection Set on Tabs Component Tests' , ( ) => {
Original file line number Diff line number Diff line change 77 < div class ="items-wrapper__item ">
88
99 < h3 class ="sample-title "> Routing sample</ h3 >
10+
11+ < button (click) ="clickHandler0() "> to Root</ button >
12+ < button (click) ="clickHandler1() "> to View1</ button >
13+ < button (click) ="clickHandler2() "> to View2</ button >
14+ < button (click) ="clickHandler3() "> to View3</ button > < br > < br >
1015
1116 < igx-tabs >
1217 < igx-tab-item label ="Tab 1 " icon ="folder "
Original file line number Diff line number Diff line change 11import { Component } from '@angular/core' ;
2+ import { Router } from '@angular/router' ;
23
34@Component ( {
45 selector : 'app-tabs-routing-sample' ,
@@ -7,6 +8,9 @@ import { Component } from '@angular/core';
78} )
89export class TabsRoutingSampleComponent {
910
11+ constructor ( private router : Router ) {
12+ }
13+
1014 contacts : any [ ] = [ {
1115 avatar : 'assets/images/avatar/1.jpg' ,
1216 favorite : true ,
@@ -37,5 +41,21 @@ export class TabsRoutingSampleComponent {
3741 text : 'Lisa Landers'
3842 } ] ;
3943
44+ public clickHandler0 ( ) {
45+ this . router . navigateByUrl ( '/tabs-routing' ) ;
46+ }
47+
48+ public clickHandler1 ( ) {
49+ this . router . navigateByUrl ( '/tabs-routing/view1' ) ;
50+ }
51+
52+ public clickHandler2 ( ) {
53+ this . router . navigateByUrl ( '/tabs-routing/view2' ) ;
54+ }
55+
56+ public clickHandler3 ( ) {
57+ this . router . navigateByUrl ( '/tabs-routing/view3' ) ;
58+ }
59+
4060}
4161
You can’t perform that action at this time.
0 commit comments