File tree 2 files changed +34
-2
lines changed
2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " preact-iso" ,
3
- "version" : " 2.6.2 " ,
3
+ "version" : " 2.6.3 " ,
4
4
"type" : " module" ,
5
5
"main" : " src/index.js" ,
6
6
"module" : " src/index.js" ,
49
49
"preact" : " 10.15.1" ,
50
50
"preact-render-to-string" : " ^6.4.0"
51
51
}
52
- }
52
+ }
Original file line number Diff line number Diff line change @@ -789,6 +789,38 @@ describe('Router', () => {
789
789
expect ( params ) . toMatchObject ( { id : 'bar' } ) ;
790
790
} ) ;
791
791
792
+ it ( 'should append params in nested routes' , async ( ) => {
793
+ let path , params ;
794
+ const Inner = ( ) => html `
795
+ < ${ Router } >
796
+ < ${ Route }
797
+ path ="/:bar/:baz"
798
+ component=${ ( ) => {
799
+ ( { path, params } = useRoute ( ) ) ;
800
+ return null ;
801
+ } }
802
+ />
803
+ </ />
804
+ ` ;
805
+
806
+ render (
807
+ html `
808
+ < ${ LocationProvider } >
809
+ < ${ Router } >
810
+ < ${ Route } path ="/foo/*" component=${ Inner } />
811
+ </ />
812
+ < a href ="/foo/bar/bob "> </ a >
813
+ </ />
814
+ ` ,
815
+ scratch
816
+ ) ;
817
+
818
+ scratch . querySelector ( 'a[href="/foo/bar/bob"]' ) . click ( ) ;
819
+ await sleep ( 20 ) ;
820
+ console . log ( path ) ;
821
+ expect ( params ) . toMatchObject ( { id : 'bar' } ) ;
822
+ } ) ;
823
+
792
824
it ( 'should replace the current URL' , async ( ) => {
793
825
const pushState = jest . spyOn ( history , 'pushState' ) ;
794
826
const replaceState = jest . spyOn ( history , 'replaceState' ) ;
You can’t perform that action at this time.
0 commit comments