@@ -80,20 +80,41 @@ describe('$routeParams', function() {
80
80
it ( 'should correctly extract path params containing hashes and/or question marks' , function ( ) {
81
81
module ( function ( $routeProvider ) {
82
82
$routeProvider . when ( '/foo/:bar' , { } ) ;
83
+ $routeProvider . when ( '/zoo/:bar/:baz/:qux' , { } ) ;
83
84
} ) ;
84
85
85
- inject ( function ( $rootScope , $route , $location , $routeParams ) {
86
+ inject ( function ( $location , $rootScope , $routeParams ) {
87
+ $location . path ( '/foo/bar?baz' ) ;
88
+ $rootScope . $digest ( ) ;
89
+ expect ( $routeParams ) . toEqual ( { bar : 'bar?baz' } ) ;
90
+
91
+ $location . path ( '/foo/bar?baz=val' ) ;
92
+ $rootScope . $digest ( ) ;
93
+ expect ( $routeParams ) . toEqual ( { bar : 'bar?baz=val' } ) ;
94
+
86
95
$location . path ( '/foo/bar#baz' ) ;
87
96
$rootScope . $digest ( ) ;
88
97
expect ( $routeParams ) . toEqual ( { bar : 'bar#baz' } ) ;
89
98
90
- $location . path ( '/foo/bar?baz' ) ;
99
+ $location . path ( '/foo/bar?baz#qux ' ) ;
91
100
$rootScope . $digest ( ) ;
92
- expect ( $routeParams ) . toEqual ( { bar : 'bar?baz' } ) ;
101
+ expect ( $routeParams ) . toEqual ( { bar : 'bar?baz#qux' } ) ;
102
+
103
+ $location . path ( '/foo/bar?baz=val#qux' ) ;
104
+ $rootScope . $digest ( ) ;
105
+ expect ( $routeParams ) . toEqual ( { bar : 'bar?baz=val#qux' } ) ;
93
106
94
107
$location . path ( '/foo/bar#baz?qux' ) ;
95
108
$rootScope . $digest ( ) ;
96
109
expect ( $routeParams ) . toEqual ( { bar : 'bar#baz?qux' } ) ;
110
+
111
+ $location . path ( '/zoo/bar?p1=v1#h1/baz?p2=v2#h2/qux?p3=v3#h3' ) ;
112
+ $rootScope . $digest ( ) ;
113
+ expect ( $routeParams ) . toEqual ( {
114
+ bar : 'bar?p1=v1#h1' ,
115
+ baz : 'baz?p2=v2#h2' ,
116
+ qux : 'qux?p3=v3#h3'
117
+ } ) ;
97
118
} ) ;
98
119
} ) ;
99
120
0 commit comments