refactor(tabs): dont pass href attribute to ionTabNav

This commit is contained in:
Andy Joslin
2014-02-25 12:32:27 -05:00
parent 0033c8809a
commit c4549bae4f
2 changed files with 11 additions and 13 deletions

View File

@@ -180,8 +180,6 @@ function($scope, $ionicViewService, $rootScope, $element) {
attrStr('icon', attr.icon) +
attrStr('icon-on', attr.iconOn) +
attrStr('icon-off', attr.iconOff) +
attrStr('ui-sref', attr.uiSref) +
attrStr('href', attr.href) +
attrStr('badge', attr.badge) +
attrStr('badge-style', attr.badgeStyle) +
'></ion-tab-nav>'
@@ -256,8 +254,6 @@ function($scope, $ionicViewService, $rootScope, $element) {
icon: '@',
iconOn: '@',
iconOff: '@',
uiSref: '@',
href: '@',
badge: '=',
badgeStyle: '@'
},

View File

@@ -265,15 +265,13 @@ describe('tabs', function() {
});
it('should compile a <ion-tab-nav> with all of the relevant attrs', function() {
setup('title=1 icon-on=3 icon-off=4 ui-sref=5 href=6 badge=7 badge-style=8');
setup('title=1 icon-on=2 icon-off=3 badge=4 badge-style=5');
var navItem = angular.element(tabsEl[0].querySelector('.tab-item'));
expect(navItem.attr('title')).toEqual('1');
expect(navItem.attr('icon-on')).toEqual('3');
expect(navItem.attr('icon-off')).toEqual('4');
expect(navItem.attr('ui-sref')).toEqual('5');
expect(navItem.attr('href')).toEqual('6');
expect(navItem.attr('badge')).toEqual('7');
expect(navItem.attr('badge-style')).toEqual('8');
expect(navItem.attr('icon-on')).toEqual('2');
expect(navItem.attr('icon-off')).toEqual('3');
expect(navItem.attr('badge')).toEqual('4');
expect(navItem.attr('badge-style')).toEqual('5');
expect(navItem.parent()[0]).toBe(tabsCtrl.$tabsElement[0]);
});
@@ -379,9 +377,13 @@ describe('tabs', function() {
tabsCtrl.selectedTab = null;
expect(el.isolateScope().isTabActive()).toBe(false);
});
it('.selectTab should be correct', function() {
it('.selectTab should be correct and preventDefault', function() {
var el = setup();
el.isolateScope().selectTab();
var preventSpy = jasmine.createSpy('preventDefault');
el.isolateScope().selectTab({
preventDefault: preventSpy
});
expect(preventSpy).toHaveBeenCalled();
expect(tabsCtrl.select).toHaveBeenCalledWith(tabCtrl.$scope, true);
});