File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -813,6 +813,32 @@ describe('$route', function() {
813
813
} ) ;
814
814
815
815
816
+ it ( 'should interpolate optional and long route vars in the redirected path from original path' , function ( ) {
817
+ module ( function ( $routeProvider ) {
818
+ $routeProvider . when ( '/foo/:id/foo/:subid?/:extraId' , { redirectTo : '/bar/:id/:subid?/23' } ) ;
819
+ $routeProvider . when ( '/baz/:id/:path*' , { redirectTo : '/path/:path*/:id' } ) ;
820
+ } ) ;
821
+
822
+ inject ( function ( $route , $location , $rootScope ) {
823
+ $location . path ( '/foo/id1/foo/subid3/gah' ) ;
824
+ $rootScope . $digest ( ) ;
825
+
826
+ expect ( $location . path ( ) ) . toEqual ( '/bar/id1/subid3/23' ) ;
827
+ expect ( $location . search ( ) ) . toEqual ( { extraId : 'gah' } ) ;
828
+
829
+ $location . path ( '/foo/id1/foo/gah' ) ;
830
+ $rootScope . $digest ( ) ;
831
+
832
+ expect ( $location . path ( ) ) . toEqual ( '/bar/id1/23' ) ;
833
+ expect ( $location . search ( ) ) . toEqual ( { extraId : 'gah' } ) ;
834
+
835
+ $location . path ( '/baz/1/foovalue/barvalue' ) ;
836
+ $rootScope . $digest ( ) ;
837
+ expect ( $location . path ( ) ) . toEqual ( '/path/foovalue/barvalue/1' ) ;
838
+ } ) ;
839
+ } ) ;
840
+
841
+
816
842
it ( 'should interpolate route vars in the redirected path from original search' , function ( ) {
817
843
module ( function ( $routeProvider ) {
818
844
$routeProvider . when ( '/bar/:id/:subid/:subsubid' , { templateUrl : 'bar.html' } ) ;
You can’t perform that action at this time.
0 commit comments