mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-25 02:40:24 +00:00
adding spec for controller-less $route definitions
This commit is contained in:
parent
21ad176246
commit
7db3b54c1f
1 changed files with 19 additions and 0 deletions
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue