File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -868,6 +868,34 @@ describe('Router', () => {
868
868
const secondLast = new URL ( entries [ entries . length - 2 ] . url ) ;
869
869
expect ( secondLast . pathname ) . to . equal ( '/' ) ;
870
870
} ) ;
871
+
872
+ it ( 'should support navigating backwards and forwards' , async ( ) => {
873
+ render (
874
+ < LocationProvider >
875
+ < Router >
876
+ < Route path = "/" component = { ( ) => null } />
877
+ < Route path = "/foo" component = { ( ) => null } />
878
+ </ Router >
879
+ < ShallowLocation />
880
+ </ LocationProvider > ,
881
+ scratch
882
+ ) ;
883
+
884
+ navigation . navigate ( '/foo' ) ;
885
+ await sleep ( 10 ) ;
886
+
887
+ expect ( loc ) . to . deep . include ( { url : '/foo' , path : '/foo' , searchParams : { } } ) ;
888
+
889
+ navigation . back ( ) ;
890
+ await sleep ( 10 ) ;
891
+
892
+ expect ( loc ) . to . deep . include ( { url : '/' , path : '/' , searchParams : { } } ) ;
893
+
894
+ navigation . forward ( ) ;
895
+ await sleep ( 10 ) ;
896
+
897
+ expect ( loc ) . to . deep . include ( { url : '/foo' , path : '/foo' , searchParams : { } } ) ;
898
+ } ) ;
871
899
} ) ;
872
900
873
901
const MODE_HYDRATE = 1 << 5 ;
You can’t perform that action at this time.
0 commit comments