refactor($route): remove .parent(); ng:view scope creation

This commit is contained in:
Misko Hevery
2012-02-15 21:49:07 -08:00
committed by Vojta Jina
parent f16bd2f747
commit e31d1c287d
6 changed files with 67 additions and 45 deletions

View File

@@ -633,6 +633,18 @@ describe('widget', function() {
}));
it('should create controller instance on $afterRouteChange event', inject(
function($route, $rootScope) {
var controllerScope;
$route.current = { controller: function($scope) { controllerScope = $scope; } };
$rootScope.$broadcast('$afterRouteChange', $route.current);
expect(controllerScope.$parent.$id).toBe($rootScope.$id);
expect(controllerScope.$id).toBe($route.current.scope.$id);
}
));
it('should load content via xhr when route changes', function() {
module(function($routeProvider) {
$routeProvider.when('/foo', {template: 'myUrl1'});