From ac5151a469667b1cc1b5e2f96d330b71631efd0b Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 12 Mar 2012 23:40:19 -0700 Subject: fix(scope): remove scope $destroy event --- test/directive/ngViewSpec.js | 12 +++++++++--- test/service/compilerSpec.js | 3 --- test/service/scopeSpec.js | 10 ---------- 3 files changed, 9 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/directive/ngViewSpec.js b/test/directive/ngViewSpec.js index 2a4347a0..7b702e51 100644 --- a/test/directive/ngViewSpec.js +++ b/test/directive/ngViewSpec.js @@ -317,9 +317,11 @@ describe('ng-view', function() { var createCtrl = function(name) { return function($scope) { log.push('init-' + name); - $scope.$on('$destroy', function() { + var destroy = $scope.$destroy; + $scope.$destroy = function() { log.push('destroy-' + name); - }); + destroy.call($scope); + } }; }; @@ -367,7 +369,11 @@ describe('ng-view', function() { function createController(name) { return function($scope) { log.push('init-' + name); - $scope.$on('$destroy', logger('destroy-' + name)); + var destroy = $scope.$destroy; + $scope.$destroy = function() { + log.push('destroy-' + name); + destroy.call($scope); + } $scope.$on('$routeUpdate', logger('route-update')); }; } diff --git a/test/service/compilerSpec.js b/test/service/compilerSpec.js index a9d0a5db..b42b871a 100644 --- a/test/service/compilerSpec.js +++ b/test/service/compilerSpec.js @@ -1743,12 +1743,9 @@ describe('$compile', function() { expect(widgetScope.$parent).toEqual($rootScope); expect(transcludeScope.$parent).toEqual($rootScope); - var removed = 0; - $rootScope.$on('$destroy', function() { removed++; }); $rootScope.select = false; $rootScope.$apply(); expect(element.text()).toEqual('Hello: Misko!'); - expect(removed).toEqual(1); expect(widgetScope.$$nextSibling).toEqual(null); }); }); diff --git a/test/service/scopeSpec.js b/test/service/scopeSpec.js index d3713e9d..95b028fe 100644 --- a/test/service/scopeSpec.js +++ b/test/service/scopeSpec.js @@ -393,16 +393,6 @@ describe('Scope', function() { $rootScope.$digest(); expect(log).toEqual('12'); })); - - it('should fire a $destroy event', inject(function($rootScope) { - var destructedScopes = []; - middle.$on('$destroy', function(event) { - destructedScopes.push(event.currentScope); - }); - middle.$destroy(); - expect(destructedScopes).toEqual([middle]); - })); - }); -- cgit v1.2.3