aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ng/routeParamsSpec.js12
-rw-r--r--test/ng/routeSpec.js32
2 files changed, 34 insertions, 10 deletions
diff --git a/test/ng/routeParamsSpec.js b/test/ng/routeParamsSpec.js
index 07c6d4f7..52fe8d2a 100644
--- a/test/ng/routeParamsSpec.js
+++ b/test/ng/routeParamsSpec.js
@@ -29,4 +29,16 @@ describe('$routeParams', function() {
expect($routeParams).toEqual({bar:'barvalue', foo:'foovalue'});
});
});
+
+ it('should support route params not preceded by slashes', function() {
+ module(function($routeProvider) {
+ $routeProvider.when('/bar:barId/foo:fooId/', {});
+ });
+
+ inject(function($rootScope, $route, $location, $routeParams) {
+ $location.path('/barbarvalue/foofoovalue/');
+ $rootScope.$digest();
+ expect($routeParams).toEqual({barId: 'barvalue', fooId: 'foovalue'});
+ });
+ });
});
diff --git a/test/ng/routeSpec.js b/test/ng/routeSpec.js
index 52fffa40..852f97b5 100644
--- a/test/ng/routeSpec.js
+++ b/test/ng/routeSpec.js
@@ -82,28 +82,40 @@ describe('$route', function() {
});
- it('should match a route that contains special chars in the path', function() {
- module(function($routeProvider) {
- $routeProvider.when('/$test.23/foo(bar)/:baz', {templateUrl: 'test.html'});
- });
- inject(function($route, $location, $rootScope) {
+ describe('should match a route that contains special chars in the path', function() {
+ beforeEach(module(function($routeProvider) {
+ $routeProvider.when('/$test.23/foo*(bar)/:baz', {templateUrl: 'test.html'});
+ }));
+ it('matches the full path', inject(function($route, $location, $rootScope) {
$location.path('/test');
$rootScope.$digest();
expect($route.current).toBeUndefined();
+ }));
- $location.path('/$testX23/foo(bar)/222');
+ it('matches literal .', inject(function($route, $location, $rootScope) {
+ $location.path('/$testX23/foo*(bar)/222');
$rootScope.$digest();
expect($route.current).toBeUndefined();
+ }));
- $location.path('/$test.23/foo(bar)/222');
+ it('matches literal *', inject(function($route, $location, $rootScope) {
+ $location.path('/$test.23/foooo(bar)/222');
$rootScope.$digest();
- expect($route.current).toBeDefined();
+ expect($route.current).toBeUndefined();
+ }));
- $location.path('/$test.23/foo\\(bar)/222');
+ it('treats backslashes normally', inject(function($route, $location, $rootScope) {
+ $location.path('/$test.23/foo*\\(bar)/222');
$rootScope.$digest();
expect($route.current).toBeUndefined();
- });
+ }));
+
+ it('matches a URL with special chars', inject(function($route, $location, $rootScope) {
+ $location.path('/$test.23/foo*(bar)/222');
+ $rootScope.$digest();
+ expect($route.current).toBeDefined();
+ }));
});