diff options
| author | Igor Minar | 2011-01-30 15:49:01 -0800 |
|---|---|---|
| committer | Igor Minar | 2011-02-01 09:33:59 -0800 |
| commit | 7db3b54c1f777327a1213d7f7b761d238cdf9652 (patch) | |
| tree | 15af59b9e0f5c801668356d3488c95bfe1a52e8e | |
| parent | 21ad1762460487b813463008747f65fd5f3216da (diff) | |
| download | angular.js-7db3b54c1f777327a1213d7f7b761d238cdf9652.tar.bz2 | |
adding spec for controller-less $route definitions
| -rw-r--r-- | test/servicesSpec.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js index c3c10552..c4fadec8 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -392,6 +392,25 @@ describe("service", function(){ scope.$eval(); expect($route.current.template).toEqual('instant update'); }); + + it('should allow routes to be defined with just templates without controllers', function() { + var scope = angular.scope(), + $location = scope.$service('$location'), + $route = scope.$service('$route'), + onChangeSpy = jasmine.createSpy('onChange'); + + $route.when('/foo', {template: 'foo.html'}); + $route.onChange(onChangeSpy); + expect($route.current).toBeNull(); + expect(onChangeSpy).not.toHaveBeenCalled(); + + $location.updateHash('/foo'); + scope.$eval(); + + expect($route.current.template).toEqual('foo.html'); + expect($route.current.controller).toBeUndefined(); + expect(onChangeSpy).toHaveBeenCalled(); + }); }); |
