mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(slidebox): add delegate filter
This commit is contained in:
9
js/angular/directive/slideBox.js
vendored
9
js/angular/directive/slideBox.js
vendored
@@ -40,7 +40,8 @@ IonicModule
|
||||
'$timeout',
|
||||
'$compile',
|
||||
'$ionicSlideBoxDelegate',
|
||||
function($timeout, $compile, $ionicSlideBoxDelegate) {
|
||||
'$ionicHistory',
|
||||
function($timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
@@ -106,7 +107,11 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
|
||||
//Exposed for testing
|
||||
this.__slider = slider;
|
||||
|
||||
var deregisterInstance = $ionicSlideBoxDelegate._registerInstance(slider, $attrs.delegateHandle);
|
||||
var deregisterInstance = $ionicSlideBoxDelegate._registerInstance(
|
||||
slider, $attrs.delegateHandle, function() {
|
||||
return $ionicHistory.isActiveScope($scope);
|
||||
}
|
||||
);
|
||||
$scope.$on('$destroy', deregisterInstance);
|
||||
|
||||
this.slidesCount = function() {
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('Ionic Angular Slide Box', function() {
|
||||
$rootScope.$apply();
|
||||
|
||||
expect($ionicSlideBoxDelegate._registerInstance)
|
||||
.toHaveBeenCalledWith(el.controller('ionSlideBox').__slider, 'superHandle');
|
||||
.toHaveBeenCalledWith(el.controller('ionSlideBox').__slider, 'superHandle', jasmine.any(Function));
|
||||
|
||||
expect(deregisterSpy).not.toHaveBeenCalled();
|
||||
el.scope().$destroy();
|
||||
|
||||
Reference in New Issue
Block a user