feat(menuClose): do not show next back button

When navigating to a view from a button/link with the `menuClose`
attribute directive, the back button should not show for the next view.
This commit is contained in:
Adam Bradley
2014-11-12 12:30:11 -06:00
parent baf98a132e
commit ba3eefdf8a
3 changed files with 50 additions and 4 deletions

View File

@@ -79,6 +79,47 @@ describe('Ionic View Switcher', function() {
expect(d.direction).toEqual('forward');
}));
it('should set showBack when the view data sets it', inject(function($ionicViewSwitcher) {
var d = $ionicViewSwitcher.getTransitionData(null, null, null, null, true);
expect(d.showBack).toEqual(true);
d = $ionicViewSwitcher.getTransitionData(null, null, null, null, false);
expect(d.showBack).toEqual(false);
d = $ionicViewSwitcher.getTransitionData(null, null, null, null, null);
expect(d.showBack).toEqual(false);
}));
it('should override showBack from view data w/ $ionicViewSwitcher.nextShowBack() setting', inject(function($ionicViewSwitcher) {
$ionicViewSwitcher.nextShowBack(true);
var d = $ionicViewSwitcher.getTransitionData(null, null, null, null, true);
expect(d.showBack).toEqual(true);
$ionicViewSwitcher.nextShowBack(false);
var d = $ionicViewSwitcher.getTransitionData(null, null, null, null, true);
expect(d.showBack).toEqual(false);
$ionicViewSwitcher.nextShowBack(true);
d = $ionicViewSwitcher.getTransitionData(null, null, null, null, false);
expect(d.showBack).toEqual(true);
$ionicViewSwitcher.nextShowBack(false);
d = $ionicViewSwitcher.getTransitionData(null, null, null, null, false);
expect(d.showBack).toEqual(false);
$ionicViewSwitcher.nextShowBack(true);
d = $ionicViewSwitcher.getTransitionData(null, null, null, null, null);
expect(d.showBack).toEqual(true);
$ionicViewSwitcher.nextShowBack(false);
d = $ionicViewSwitcher.getTransitionData(null, null, null, null, null);
expect(d.showBack).toEqual(false);
$ionicViewSwitcher.nextShowBack(null);
d = $ionicViewSwitcher.getTransitionData(null, null, null, null, true);
expect(d.showBack).toEqual(true);
}));
it('should get an empty entering element with an empty navViewElement', inject(function($ionicViewSwitcher) {
var navViewElement = angular.element('<div class="view-container">');
var switcher = $ionicViewSwitcher.create(null, navViewElement, {}, {});