Skip to content

Commit

Permalink
amend(ionTab): fix tests for class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Jun 11, 2014
1 parent 30a3c8e commit a034561
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/angular/directive/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +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) +
attrStr('class', attr['class']) +
'></ion-tab-nav>';

//Remove the contents of the element so we can compile them later, if tab is selected
Expand Down
4 changes: 2 additions & 2 deletions js/angular/directive/tabNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ IonicModule
require: ['^ionTabs', '^ionTab'],
template:
'<a ng-class="{\'tab-item-active\': isTabActive(), \'has-badge\':badge}" ' +
' class="tab-item {{class}}">' +
' class="tab-item">' +
'<span class="badge {{badgeStyle}}" ng-if="badge">{{badge}}</span>' +
'<i class="icon {{getIconOn()}}" ng-if="getIconOn() && isTabActive()"></i>' +
'<i class="icon {{getIconOff()}}" ng-if="getIconOff() && !isTabActive()"></i>' +
Expand All @@ -19,7 +19,7 @@ IonicModule
iconOff: '@',
badge: '=',
badgeStyle: '@',
class: '@'
'class': '@'
},
compile: function(element, attr, transclude) {
return function link($scope, $element, $attrs, ctrls) {
Expand Down
8 changes: 4 additions & 4 deletions test/unit/angular/directive/tabs.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ describe('tabs', function() {
c: 'off',
d: 6,
e: 'badger',
f: 'class'
f: 'someClass'
});
tabEl.scope().$apply();
var navItem = angular.element(tabsEl[0].querySelector('.tab-item'));
Expand All @@ -406,7 +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[0].className).toMatch(/someClass/);
expect(navItem.attr('ng-click')).toEqual('click');

angular.extend(tabEl.scope(), {
Expand All @@ -415,15 +415,15 @@ describe('tabs', function() {
c: 'off2',
d: 7,
e: 'badger2',
f: 'class2'
f: 'someClass2'
});
tabEl.scope().$apply();
expect(navItem.isolateScope().title).toEqual('title2');
expect(navItem.isolateScope().iconOn).toEqual('on2');
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[0].className).toMatch(/someClass2/);

expect(navItem.parent()[0]).toBe(tabsCtrl.$tabsElement[0]);
});
Expand Down

0 comments on commit a034561

Please sign in to comment.