From bca96e7c7cc723a091241fddd6845d6de262a3c9 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 16 Mar 2012 10:52:20 -0700 Subject: style(ngViewSpec): pretify some tests with $destroy events --- test/directive/ngViewSpec.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'test/directive/ngViewSpec.js') diff --git a/test/directive/ngViewSpec.js b/test/directive/ngViewSpec.js index 7b702e51..bf3706ac 100644 --- a/test/directive/ngViewSpec.js +++ b/test/directive/ngViewSpec.js @@ -317,11 +317,7 @@ describe('ng-view', function() { var createCtrl = function(name) { return function($scope) { log.push('init-' + name); - var destroy = $scope.$destroy; - $scope.$destroy = function() { - log.push('destroy-' + name); - destroy.call($scope); - } + $scope.$on('$destroy', function() {log.push('destroy-' + name);}); }; }; @@ -369,11 +365,7 @@ describe('ng-view', function() { function createController(name) { return function($scope) { log.push('init-' + name); - var destroy = $scope.$destroy; - $scope.$destroy = function() { - log.push('destroy-' + name); - destroy.call($scope); - } + $scope.$on('$destroy', logger('destroy-' + name)); $scope.$on('$routeUpdate', logger('route-update')); }; } -- cgit v1.2.3