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