diff options
Diffstat (limited to 'test/servicesSpec.js')
| -rw-r--r-- | test/servicesSpec.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js index ddad5d89..91a5389a 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -503,6 +503,28 @@ describe("service", function(){ expect($route.current.template).toBe('bar.html'); expect(onChangeSpy.callCount).toBe(1); }); + + it('should make parentScope configurable via parent()', function() { + var scope = angular.scope(), + parentScope = scope.$new(), + $location = scope.$service('$location'), + $route = scope.$service('$route'); + + $route.parent(parentScope); + $route.when('/foo', {template: 'foo.html'}); + $route.otherwise({template: '404.html'}); + + scope.$eval(); + + expect($route.current.template).toBe('404.html'); + expect($route.current.scope.$parent).toBe(parentScope); + + $location.updateHash('/foo'); + scope.$eval(); + + expect($route.current.template).toBe('foo.html'); + expect($route.current.scope.$parent).toBe(parentScope); + }); }); |
