File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -946,6 +946,51 @@ describe('Router', () => {
946946 expect ( scratch ) . to . have . property ( 'textContent' , 'data' ) ;
947947 } ) ;
948948
949+ it ( 'should support navigating backwards and forwards' , async ( ) => {
950+ render (
951+ < LocationProvider >
952+ < Router >
953+ < Route path = "/" component = { ( ) => null } />
954+ < Route path = "/foo" component = { ( ) => null } />
955+ </ Router >
956+ < ShallowLocation />
957+ </ LocationProvider > ,
958+ scratch
959+ ) ;
960+
961+ expect ( scratch ) . to . have . property ( 'textContent' , '' ) ;
962+ await sleep ( 10 ) ;
963+ expect ( scratch ) . to . have . property ( 'textContent' , 'data' ) ;
964+ } ) ;
965+
966+ it ( 'should support navigating backwards and forwards' , async ( ) => {
967+ render (
968+ < LocationProvider >
969+ < Router >
970+ < Route path = "/" component = { ( ) => null } />
971+ < Route path = "/foo" component = { ( ) => null } />
972+ </ Router >
973+ < ShallowLocation />
974+ </ LocationProvider > ,
975+ scratch
976+ ) ;
977+
978+ navigation . navigate ( '/foo' ) ;
979+ await sleep ( 10 ) ;
980+
981+ expect ( loc ) . to . deep . include ( { url : '/foo' , path : '/foo' , searchParams : { } } ) ;
982+
983+ navigation . back ( ) ;
984+ await sleep ( 10 ) ;
985+
986+ expect ( loc ) . to . deep . include ( { url : '/' , path : '/' , searchParams : { } } ) ;
987+
988+ navigation . forward ( ) ;
989+ await sleep ( 10 ) ;
990+
991+ expect ( loc ) . to . deep . include ( { url : '/foo' , path : '/foo' , searchParams : { } } ) ;
992+ } ) ;
993+
949994 it ( 'should intercept clicks on links inside open shadow DOM' , async ( ) => {
950995 const shadowlink = document . createElement ( 'a' ) ;
951996 shadowlink . href = '/shadow' ;
You can’t perform that action at this time.
0 commit comments