diff options
| author | Igor Minar | 2011-09-21 13:47:17 +0200 |
|---|---|---|
| committer | Igor Minar | 2011-09-27 01:45:54 +0200 |
| commit | f7a5f1788a794d082a05e48f728b22b47a6cc622 (patch) | |
| tree | cf4db4364489f3b3e1bfb9b19a9a09ce3812c08b /test/service | |
| parent | b3ed7a8a7a45882751407fbb645302ee14ce1a79 (diff) | |
| download | angular.js-f7a5f1788a794d082a05e48f728b22b47a6cc622.tar.bz2 | |
fix($route): fix regex escaping in route matcher
Diffstat (limited to 'test/service')
| -rw-r--r-- | test/service/routeSpec.js | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/test/service/routeSpec.js b/test/service/routeSpec.js index 4d24279c..7422ab56 100644 --- a/test/service/routeSpec.js +++ b/test/service/routeSpec.js @@ -55,14 +55,37 @@ describe('$route', function() { it('should return fn registered with onChange()', function() { - var scope = angular.scope(), - $route = scope.$service('$route'), + var $route = scope.$service('$route'), fn = function() {}; expect($route.onChange(fn)).toBe(fn); }); + it('should match a route that contains special chars in the path', function() { + var $route = scope.$service('$route'), + $location = scope.$service('$location'); + + $route.when('/$test.23/foo(bar)/:baz', {template: 'test.html'}); + + $location.hashPath = '/test'; + scope.$eval(); + expect($route.current).toBe(null); + + $location.hashPath = '/$testX23/foo(bar)/222'; + scope.$eval(); + expect($route.current).toBe(null); + + $location.hashPath = '/$test.23/foo(bar)/222'; + scope.$eval(); + expect($route.current).toBeDefined(); + + $location.hashPath = '/$test.23/foo\\(bar)/222'; + scope.$eval(); + expect($route.current).toBe(null); + }); + + it('should allow routes to be defined with just templates without controllers', function() { var scope = angular.scope(), $location = scope.$service('$location'), |
