aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng')
-rw-r--r--test/ng/routeParamsSpec.js4
-rw-r--r--test/ng/routeSpec.js20
2 files changed, 21 insertions, 3 deletions
diff --git a/test/ng/routeParamsSpec.js b/test/ng/routeParamsSpec.js
index d1b2ecb1..e3aac1a2 100644
--- a/test/ng/routeParamsSpec.js
+++ b/test/ng/routeParamsSpec.js
@@ -3,8 +3,8 @@
describe('$routeParams', function() {
it('should publish the params into a service', function() {
module(function($routeProvider) {
- $routeProvider.when('/foo');
- $routeProvider.when('/bar/:barId');
+ $routeProvider.when('/foo', {});
+ $routeProvider.when('/bar/:barId', {});
});
inject(function($rootScope, $route, $location, $routeParams) {
diff --git a/test/ng/routeSpec.js b/test/ng/routeSpec.js
index 88e54b9a..b66cbb8e 100644
--- a/test/ng/routeSpec.js
+++ b/test/ng/routeSpec.js
@@ -10,7 +10,7 @@ describe('$route', function() {
module(function($routeProvider) {
$routeProvider.when('/Book/:book/Chapter/:chapter',
{controller: noop, template: 'Chapter.html'});
- $routeProvider.when('/Blank');
+ $routeProvider.when('/Blank', {});
});
inject(function($route, $location, $rootScope) {
$rootScope.$on('$beforeRouteChange', function(event, next, current) {
@@ -147,6 +147,24 @@ describe('$route', function() {
});
+ it('should chain whens and otherwise', function() {
+ module(function($routeProvider){
+ $routeProvider.when('/foo', {template: 'foo.html'}).
+ otherwise({template: 'bar.html'}).
+ when('/baz', {template: 'baz.html'});
+ });
+
+ inject(function($route, $location, $rootScope) {
+ $rootScope.$digest();
+ expect($route.current.template).toBe('bar.html');
+
+ $location.url('/baz');
+ $rootScope.$digest();
+ expect($route.current.template).toBe('baz.html');
+ });
+ });
+
+
it('should not fire $after/beforeRouteChange during bootstrap (if no route)', function() {
var routeChangeSpy = jasmine.createSpy('route change');