@@ -55,14 +55,37 @@ describe('$route', function() {
55
55
56
56
57
57
it ( 'should return fn registered with onChange()' , function ( ) {
58
- var scope = angular . scope ( ) ,
59
- $route = scope . $service ( '$route' ) ,
58
+ var $route = scope . $service ( '$route' ) ,
60
59
fn = function ( ) { } ;
61
60
62
61
expect ( $route . onChange ( fn ) ) . toBe ( fn ) ;
63
62
} ) ;
64
63
65
64
65
+ it ( 'should match a route that contains special chars in the path' , function ( ) {
66
+ var $route = scope . $service ( '$route' ) ,
67
+ $location = scope . $service ( '$location' ) ;
68
+
69
+ $route . when ( '/$test.23/foo(bar)/:baz' , { template : 'test.html' } ) ;
70
+
71
+ $location . hashPath = '/test' ;
72
+ scope . $eval ( ) ;
73
+ expect ( $route . current ) . toBe ( null ) ;
74
+
75
+ $location . hashPath = '/$testX23/foo(bar)/222' ;
76
+ scope . $eval ( ) ;
77
+ expect ( $route . current ) . toBe ( null ) ;
78
+
79
+ $location . hashPath = '/$test.23/foo(bar)/222' ;
80
+ scope . $eval ( ) ;
81
+ expect ( $route . current ) . toBeDefined ( ) ;
82
+
83
+ $location . hashPath = '/$test.23/foo\\(bar)/222' ;
84
+ scope . $eval ( ) ;
85
+ expect ( $route . current ) . toBe ( null ) ;
86
+ } ) ;
87
+
88
+
66
89
it ( 'should allow routes to be defined with just templates without controllers' , function ( ) {
67
90
var scope = angular . scope ( ) ,
68
91
$location = scope . $service ( '$location' ) ,
0 commit comments