feat($ionicActionSheet): add cancelOnStateChange option, default true

Closes #1318

BREAKING CHANGE: $ionicActionSheet's default behavior is now to cancel
when the app's state changes.  To disable this behavior, pass
`cancelOnStateChange: false` into $ionicActionSheet.show().
This commit is contained in:
Andrew Joslin
2014-06-11 11:28:53 -06:00
parent 05dd7b1864
commit 087e55f320
2 changed files with 26 additions and 0 deletions

View File

@@ -84,4 +84,20 @@ describe('Ionic ActionSheet Service', function() {
expect(cancelSpy).toHaveBeenCalled();
}));
it('should cancelOnStateChange by default', inject(function($rootScope) {
var scope = setup();
spyOn(scope, 'cancel');
$rootScope.$broadcast('$stateChangeSuccess');
expect(scope.cancel).toHaveBeenCalled();
}));
it('should not cancelOnStateChange with option as false', inject(function($rootScope) {
var scope = setup({
cancelOnStateChange: false
});
spyOn(scope, 'cancel');
$rootScope.$broadcast('$stateChangeSuccess');
expect(scope.cancel).not.toHaveBeenCalled();
}));
});