This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 2
2
< md-content class ="md-padding ">
3
3
< md-tabs class ="md-primary " md-selected ="data.selectedIndex "
4
4
md-align-tabs ="{{data.bottom ? 'bottom' : 'top'}} ">
5
- < md-tab id ="tab1 ">
5
+ < md-tab id ="tab1 " md-tab-class =" example-selector-tab1 " >
6
6
< md-tab-label > Item One</ md-tab-label >
7
7
< md-tab-body >
8
8
View for Item #1 < br />
Original file line number Diff line number Diff line change 25
25
* @param {string= } label Optional attribute to specify a simple string as the tab label
26
26
* @param {boolean= } ng-disabled If present and expression evaluates to truthy, disabled tab
27
27
* selection.
28
+ * @param {string= } md-tab-class Optional attribute to specify a class that will be applied to the tab's button
28
29
* @param {expression= } md-on-deselect Expression to be evaluated after the tab has been
29
30
* de-selected.
30
31
* @param {expression= } md-on-select Expression to be evaluated after the tab has been selected.
35
36
* @usage
36
37
*
37
38
* <hljs lang="html">
38
- * <md-tab label="My Tab" ng-disabled md-on-select="onSelect()" md-on-deselect="onDeselect()">
39
+ * <md-tab label="My Tab" md-tab-class="my-content-tab" ng-disabled md-on-select="onSelect()" md-on-deselect="onDeselect()">
39
40
* <h3>My Tab content</h3>
40
41
* </md-tab>
41
42
*
@@ -89,7 +90,8 @@ function MdTab () {
89
90
active : '=?mdActive' ,
90
91
disabled : '=?ngDisabled' ,
91
92
select : '&?mdOnSelect' ,
92
- deselect : '&?mdOnDeselect'
93
+ deselect : '&?mdOnDeselect' ,
94
+ tabClass : '@mdTabClass'
93
95
}
94
96
} ;
95
97
Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ function MdTabs ($$mdSvgRegistry) {
165
165
'aria-label="{{::$mdTabsCtrl.navigationHint}}">' +
166
166
'<md-tab-item ' +
167
167
'tabindex="{{ tab.isActive() ? 0 : -1 }}" ' +
168
- 'class="md-tab" ' +
168
+ 'class="md-tab {{::tab.scope.tabClass}} " ' +
169
169
'ng-repeat="tab in $mdTabsCtrl.tabs" ' +
170
170
'role="tab" ' +
171
171
'id="tab-item-{{::tab.id}}" ' +
Original file line number Diff line number Diff line change @@ -450,6 +450,16 @@ describe('<md-tabs>', function () {
450
450
expect ( tab . find ( 'md-tab-label' ) . text ( ) ) . toBe ( 'test' ) ;
451
451
expect ( tab . find ( 'md-tab-body' ) . length ) . toBe ( 0 ) ;
452
452
} ) ;
453
+ it ( 'should apply tab class on the associated md-tab-item' , function ( ) {
454
+ var template = '\
455
+ <md-tabs md-selected="selectedTab">\
456
+ <md-tab label="a" md-tab-class="tester-class"></md-tab>\
457
+ </md-tabs>' ;
458
+ var element = setup ( template ) ;
459
+ var tab = element . find ( 'md-tab-item' ) ;
460
+
461
+ expect ( tab [ 0 ] . className . indexOf ( 'tester-class' ) ) . toBeGreaterThan ( - 1 ) ;
462
+ } ) ;
453
463
} ) ;
454
464
455
465
describe ( 'internal scope' , function ( ) {
You can’t perform that action at this time.
0 commit comments