@@ -41,6 +41,7 @@ describe('MDC-based MatTabGroup', () => {
41
41
TabGroupWithIndirectDescendantTabs ,
42
42
TabGroupWithSpaceAbove ,
43
43
NestedTabGroupWithLabel ,
44
+ TabsWithClassesTestApp ,
44
45
] ,
45
46
} ) ;
46
47
@@ -364,7 +365,6 @@ describe('MDC-based MatTabGroup', () => {
364
365
365
366
expect ( contentElements . map ( e => e . getAttribute ( 'tabindex' ) ) ) . toEqual ( [ '1' , null , null ] ) ;
366
367
} ) ;
367
-
368
368
} ) ;
369
369
370
370
describe ( 'aria labelling' , ( ) => {
@@ -409,6 +409,7 @@ describe('MDC-based MatTabGroup', () => {
409
409
410
410
describe ( 'disable tabs' , ( ) => {
411
411
let fixture : ComponentFixture < DisabledTabsTestApp > ;
412
+
412
413
beforeEach ( ( ) => {
413
414
fixture = TestBed . createComponent ( DisabledTabsTestApp ) ;
414
415
} ) ;
@@ -482,7 +483,6 @@ describe('MDC-based MatTabGroup', () => {
482
483
expect ( tabs [ 0 ] . origin ) . toBeLessThan ( 0 ) ;
483
484
} ) ) ;
484
485
485
-
486
486
it ( 'should update selected index if the last tab removed while selected' , fakeAsync ( ( ) => {
487
487
const component : MatTabGroup =
488
488
fixture . debugElement . query ( By . css ( 'mat-tab-group' ) ) . componentInstance ;
@@ -500,7 +500,6 @@ describe('MDC-based MatTabGroup', () => {
500
500
expect ( component . selectedIndex ) . toBe ( numberOfTabs - 2 ) ;
501
501
} ) ) ;
502
502
503
-
504
503
it ( 'should maintain the selected tab if a new tab is added' , ( ) => {
505
504
fixture . detectChanges ( ) ;
506
505
const component : MatTabGroup =
@@ -517,7 +516,6 @@ describe('MDC-based MatTabGroup', () => {
517
516
expect ( component . _tabs . toArray ( ) [ 2 ] . isActive ) . toBe ( true ) ;
518
517
} ) ;
519
518
520
-
521
519
it ( 'should maintain the selected tab if a tab is removed' , ( ) => {
522
520
// Select the second tab.
523
521
fixture . componentInstance . selectedIndex = 1 ;
@@ -565,7 +563,6 @@ describe('MDC-based MatTabGroup', () => {
565
563
566
564
expect ( fixture . componentInstance . handleSelection ) . not . toHaveBeenCalled ( ) ;
567
565
} ) ) ;
568
-
569
566
} ) ;
570
567
571
568
describe ( 'async tabs' , ( ) => {
@@ -935,6 +932,7 @@ class SimpleTabsTestApp {
935
932
animationDone ( ) { }
936
933
}
937
934
935
+
938
936
@Component ( {
939
937
template : `
940
938
<mat-tab-group class="tab-group"
@@ -965,6 +963,7 @@ class SimpleDynamicTabsTestApp {
965
963
}
966
964
}
967
965
966
+
968
967
@Component ( {
969
968
template : `
970
969
<mat-tab-group class="tab-group" [(selectedIndex)]="selectedIndex">
@@ -990,8 +989,8 @@ class BindedTabsTestApp {
990
989
}
991
990
}
992
991
992
+
993
993
@Component ( {
994
- selector : 'test-app' ,
995
994
template : `
996
995
<mat-tab-group class="tab-group">
997
996
<mat-tab>
@@ -1014,6 +1013,7 @@ class DisabledTabsTestApp {
1014
1013
isDisabled = false ;
1015
1014
}
1016
1015
1016
+
1017
1017
@Component ( {
1018
1018
template : `
1019
1019
<mat-tab-group class="tab-group">
@@ -1059,7 +1059,6 @@ class TabGroupWithSimpleApi {
1059
1059
1060
1060
1061
1061
@Component ( {
1062
- selector : 'nested-tabs' ,
1063
1062
template : `
1064
1063
<mat-tab-group>
1065
1064
<mat-tab label="One">Tab one content</mat-tab>
@@ -1077,8 +1076,8 @@ class NestedTabs {
1077
1076
@ViewChildren ( MatTabGroup ) groups : QueryList < MatTabGroup > ;
1078
1077
}
1079
1078
1079
+
1080
1080
@Component ( {
1081
- selector : 'template-tabs' ,
1082
1081
template : `
1083
1082
<mat-tab-group>
1084
1083
<mat-tab label="One">
@@ -1091,11 +1090,11 @@ class NestedTabs {
1091
1090
</mat-tab>
1092
1091
</mat-tab-group>
1093
1092
` ,
1094
- } )
1095
- class TemplateTabs { }
1093
+ } )
1094
+ class TemplateTabs { }
1096
1095
1097
1096
1098
- @Component ( {
1097
+ @Component ( {
1099
1098
template : `
1100
1099
<mat-tab-group>
1101
1100
<mat-tab [aria-label]="ariaLabel" [aria-labelledby]="ariaLabelledby"></mat-tab>
@@ -1160,6 +1159,7 @@ class TabGroupWithInkBarFitToContent {
1160
1159
fitInkBarToContent = true ;
1161
1160
}
1162
1161
1162
+
1163
1163
@Component ( {
1164
1164
template : `
1165
1165
<div style="height: 300px; background-color: aqua">
@@ -1202,3 +1202,31 @@ class TabGroupWithSpaceAbove {
1202
1202
} )
1203
1203
class NestedTabGroupWithLabel {
1204
1204
}
1205
+
1206
+
1207
+ @Component ( {
1208
+ template : `
1209
+ <mat-tab-group class="tab-group">
1210
+ <mat-tab label="Tab One">
1211
+ Tab one content
1212
+ </mat-tab>
1213
+ <mat-tab label="Tab Two" [class]="labelClassList">
1214
+ Tab two content
1215
+ </mat-tab>
1216
+ <mat-tab label="Tab Three" [bodyClass]="bodyClassList">
1217
+ Tab three content
1218
+ </mat-tab>
1219
+ <mat-tab label="Tab Four" [class]="labelClassList" [bodyClass]="bodyClassList">
1220
+ Tab four content
1221
+ </mat-tab>
1222
+ <mat-tab label="Tab Five" class="hardcoded label classes" bodyClass="hardcoded body classes">
1223
+ Tab five content
1224
+ </mat-tab>
1225
+ </mat-tab-group>
1226
+ ` ,
1227
+ } )
1228
+ class TabsWithClassesTestApp {
1229
+ @ViewChildren ( MatTab ) tabs : QueryList < MatTab > ;
1230
+ labelClassList ?: string | string [ ] ;
1231
+ bodyClassList ?: string | string [ ] ;
1232
+ }
0 commit comments