Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit bca96e7

Browse files
committed
style(ngViewSpec): pretify some tests with $destroy events
1 parent 9b1aff9 commit bca96e7

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

test/directive/ngViewSpec.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,7 @@ describe('ng-view', function() {
317317
var createCtrl = function(name) {
318318
return function($scope) {
319319
log.push('init-' + name);
320-
var destroy = $scope.$destroy;
321-
$scope.$destroy = function() {
322-
log.push('destroy-' + name);
323-
destroy.call($scope);
324-
}
320+
$scope.$on('$destroy', function() {log.push('destroy-' + name);});
325321
};
326322
};
327323

@@ -369,11 +365,7 @@ describe('ng-view', function() {
369365
function createController(name) {
370366
return function($scope) {
371367
log.push('init-' + name);
372-
var destroy = $scope.$destroy;
373-
$scope.$destroy = function() {
374-
log.push('destroy-' + name);
375-
destroy.call($scope);
376-
}
368+
$scope.$on('$destroy', logger('destroy-' + name));
377369
$scope.$on('$routeUpdate', logger('route-update'));
378370
};
379371
}

0 commit comments

Comments
 (0)