diff --git a/js/angular/directive/tab.js b/js/angular/directive/tab.js index 7075ff64305..c86e6b22126 100644 --- a/js/angular/directive/tab.js +++ b/js/angular/directive/tab.js @@ -64,6 +64,7 @@ function($rootScope, $animate, $ionicBind, $compile) { attrStr('icon-off', attr.iconOff) + attrStr('badge', attr.badge) + attrStr('badge-style', attr.badgeStyle) + + attrStr('class', attr.class) + '>'; //Remove the contents of the element so we can compile them later, if tab is selected diff --git a/js/angular/directive/tabNav.js b/js/angular/directive/tabNav.js index e49880a203a..2e05599d8f6 100644 --- a/js/angular/directive/tabNav.js +++ b/js/angular/directive/tabNav.js @@ -6,7 +6,7 @@ IonicModule require: ['^ionTabs', '^ionTab'], template: '' + + ' class="tab-item {{class}}">' + '{{badge}}' + '' + '' + @@ -18,7 +18,8 @@ IonicModule iconOn: '@', iconOff: '@', badge: '=', - badgeStyle: '@' + badgeStyle: '@', + class: '@' }, compile: function(element, attr, transclude) { return function link($scope, $element, $attrs, ctrls) { diff --git a/test/unit/angular/directive/tabs.unit.js b/test/unit/angular/directive/tabs.unit.js index 2c9173b42c9..ff69a613f56 100644 --- a/test/unit/angular/directive/tabs.unit.js +++ b/test/unit/angular/directive/tabs.unit.js @@ -390,13 +390,14 @@ describe('tabs', function() { }); it('should compile a with all of the relevant attrs', function() { - setup('title="{{a}}" icon-on="{{b}}" icon-off="{{c}}" badge="d" badge-style="{{e}}" ng-click="click"'); + setup('title="{{a}}" icon-on="{{b}}" icon-off="{{c}}" badge="d" badge-style="{{e}}" class="{{f}}" ng-click="click"'); angular.extend(tabEl.scope(), { a: 'title', b: 'on', c: 'off', d: 6, - e: 'badger' + e: 'badger', + f: 'class' }); tabEl.scope().$apply(); var navItem = angular.element(tabsEl[0].querySelector('.tab-item')); @@ -405,6 +406,7 @@ describe('tabs', function() { expect(navItem.isolateScope().iconOff).toEqual('off'); expect(navItem.isolateScope().badge).toEqual(6); expect(navItem.isolateScope().badgeStyle).toEqual('badger'); + expect(navItem.isolateScope().class).toEqual('class'); expect(navItem.attr('ng-click')).toEqual('click'); angular.extend(tabEl.scope(), { @@ -412,7 +414,8 @@ describe('tabs', function() { b: 'on2', c: 'off2', d: 7, - e: 'badger2' + e: 'badger2', + f: 'class2' }); tabEl.scope().$apply(); expect(navItem.isolateScope().title).toEqual('title2'); @@ -420,6 +423,7 @@ describe('tabs', function() { expect(navItem.isolateScope().iconOff).toEqual('off2'); expect(navItem.isolateScope().badge).toEqual(7); expect(navItem.isolateScope().badgeStyle).toEqual('badger2'); + expect(navItem.isolateScope().class).toEqual('class2'); expect(navItem.parent()[0]).toBe(tabsCtrl.$tabsElement[0]); });