@@ -219,13 +219,13 @@ describe('$route', function() {
219
219
expect ( $route . current ) . toBeUndefined ( ) ;
220
220
} ) ) ;
221
221
222
- it ( 'matches literal * ' , inject ( function ( $route , $location , $rootScope ) {
222
+ it ( 'matches literal . ' , inject ( function ( $route , $location , $rootScope ) {
223
223
$location . path ( '/$testX23/foo*(bar)/222' ) ;
224
224
$rootScope . $digest ( ) ;
225
225
expect ( $route . current ) . toBeUndefined ( ) ;
226
226
} ) ) ;
227
227
228
- it ( 'matches literal . ' , inject ( function ( $route , $location , $rootScope ) {
228
+ it ( 'matches literal * ' , inject ( function ( $route , $location , $rootScope ) {
229
229
$location . path ( '/$test.23/foooo(bar)/222' ) ;
230
230
$rootScope . $digest ( ) ;
231
231
expect ( $route . current ) . toBeUndefined ( ) ;
@@ -830,6 +830,29 @@ describe('$route', function() {
830
830
} ) ;
831
831
832
832
833
+ it ( 'should properly interpolate optional and eager route vars ' +
834
+ 'when redirecting from path with trailing slash' , function ( ) {
835
+ module ( function ( $routeProvider ) {
836
+ $routeProvider . when ( '/foo/:id?/:subid?' , { templateUrl : 'foo.html' } ) ;
837
+ $routeProvider . when ( '/bar/:id*/:subid' , { templateUrl : 'bar.html' } ) ;
838
+ } ) ;
839
+
840
+ inject ( function ( $location , $rootScope , $route ) {
841
+ $location . path ( '/foo/id1/subid2/' ) ;
842
+ $rootScope . $digest ( ) ;
843
+
844
+ expect ( $location . path ( ) ) . toEqual ( '/foo/id1/subid2' ) ;
845
+ expect ( $route . current . templateUrl ) . toEqual ( 'foo.html' ) ;
846
+
847
+ $location . path ( '/bar/id1/extra/subid2/' ) ;
848
+ $rootScope . $digest ( ) ;
849
+
850
+ expect ( $location . path ( ) ) . toEqual ( '/bar/id1/extra/subid2' ) ;
851
+ expect ( $route . current . templateUrl ) . toEqual ( 'bar.html' ) ;
852
+ } ) ;
853
+ } ) ;
854
+
855
+
833
856
it ( 'should allow custom redirectTo function to be used' , function ( ) {
834
857
function customRedirectFn ( routePathParams , path , search ) {
835
858
expect ( routePathParams ) . toEqual ( { id : 'id3' } ) ;
0 commit comments