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