aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgor Minar2011-02-01 07:43:09 -0800
committerIgor Minar2011-02-01 09:35:19 -0800
commit9fd3dfe49d283c136e29bf60c0da6d4fe2aaed3d (patch)
treed605c609e64df5ba8b0bd337f434994fa6d4fc76 /test
parentd7686a429c43fd031a0d39788973f726d74bdb33 (diff)
downloadangular.js-9fd3dfe49d283c136e29bf60c0da6d4fe2aaed3d.tar.bz2
add support for $route.reload()
Closes 254
Diffstat (limited to 'test')
-rw-r--r--test/servicesSpec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js
index 91a5389a..a081882d 100644
--- a/test/servicesSpec.js
+++ b/test/servicesSpec.js
@@ -525,6 +525,31 @@ describe("service", function(){
expect($route.current.template).toBe('foo.html');
expect($route.current.scope.$parent).toBe(parentScope);
});
+
+ it('should reload routes when reload() is called', function() {
+ var scope = angular.scope(),
+ $location = scope.$service('$location'),
+ $route = scope.$service('$route'),
+ onChangeSpy = jasmine.createSpy('onChange');
+
+ $route.when('', {template: 'foo.html'});
+ $route.onChange(onChangeSpy);
+ expect($route.current).toBeNull();
+ expect(onChangeSpy).not.toHaveBeenCalled();
+
+ scope.$eval();
+
+ expect($location.hash).toBe('');
+ expect($route.current.template).toBe('foo.html');
+ expect(onChangeSpy.callCount).toBe(1);
+
+ $route.reload();
+ scope.$eval();
+
+ expect($location.hash).toBe('');
+ expect($route.current.template).toBe('foo.html');
+ expect(onChangeSpy.callCount).toBe(2);
+ });
});