diff --git a/js/ext/angular/src/directive/ionicViewState.js b/js/ext/angular/src/directive/ionicViewState.js index 45c5690d69b..f3585990159 100644 --- a/js/ext/angular/src/directive/ionicViewState.js +++ b/js/ext/angular/src/directive/ionicViewState.js @@ -95,7 +95,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu if(tAttrs.type) tElement.addClass(tAttrs.type); return function link($scope, $element, $attr) { - var canHaveBackButton = !(!tAttrs.backButtonType && !tAttrs.backButtonLabel); + var canHaveBackButton = !(!tAttrs.backButtonType && !tAttrs.backButtonLabel && !tAttrs.backButtonIcon); $scope.enableBackButton = canHaveBackButton; $rootScope.$on('viewState.showNavBar', function(e, showNavBar) { diff --git a/js/ext/angular/test/directive/ionicView.unit.js b/js/ext/angular/test/directive/ionicView.unit.js index 089ddde7bc7..62a09d6bfbf 100644 --- a/js/ext/angular/test/directive/ionicView.unit.js +++ b/js/ext/angular/test/directive/ionicView.unit.js @@ -83,13 +83,41 @@ describe('Ionic View', function() { expect(element.hasClass('bar-positive')).toEqual(true); }); - it('should not show the back button if no back button attributes set', function() { + it('should not have the back button if no back button attributes set', function() { var element = compile('')(scope); scope.$digest(); var backButton = element.find('div').find('button'); expect(backButton.length).toEqual(0); }); + it('should have the back button if back-button-type attributes set', function() { + var element = compile('')(scope); + scope.$digest(); + var backButton = element.find('div').find('button'); + expect(backButton.length).toEqual(1); + }); + + it('should have the back button if back-button-icon attributes set', function() { + var element = compile('')(scope); + scope.$digest(); + var backButton = element.find('div').find('button'); + expect(backButton.length).toEqual(1); + }); + + it('should have the back button if back-button-label attributes set', function() { + var element = compile('')(scope); + scope.$digest(); + var backButton = element.find('div').find('button'); + expect(backButton.length).toEqual(1); + }); + + it('should have the back button if all back button attributes set', function() { + var element = compile('')(scope); + scope.$digest(); + var backButton = element.find('div').find('button'); + expect(backButton.length).toEqual(1); + }); + it('should set just a back button icon, no text', function() { var element = compile('')(scope); scope.$digest(); @@ -111,7 +139,7 @@ describe('Ionic View', function() { expect(backButton.html()).toEqual('Back'); }); - it('should set a back button with an icon and text, button-clear', function() { + it('should set a back button with an icon and text, button-icon', function() { var element = compile('')(scope); scope.$digest(); var backButton = element.find('div').find('button');