File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -602,4 +602,33 @@ function testGenerateWithPortInHost() {
602602 } ) ;
603603
604604 assertEquals ( '/foo/' , router . generate ( 'homepage' ) ) ;
605- }
605+ }
606+
607+ function testGenerateWithNullableDefaults ( ) {
608+ var router = new fos . Router ( { base_url : '/foo' } , {
609+ homepage : {
610+ tokens : [
611+ [ 'text' , '/' ] ,
612+ [
613+ 'variable' ,
614+ '/' ,
615+ '\d*' ,
616+ 'id' ,
617+ true ,
618+ ] ,
619+ ] ,
620+ defaults : {
621+ 'id' : null ,
622+ } ,
623+ requirements : {
624+ 'id' : '\d*' ,
625+ } ,
626+ hosttokens : [ ] ,
627+ methods : [ ] ,
628+ schemes : [ ] ,
629+ } ,
630+ } ) ;
631+
632+ assertEquals ( '/foo//' , router . generate ( 'homepage' ) ) ;
633+ assertEquals ( '/foo/1234/' , router . generate ( 'homepage' , { id : 1234 } ) ) ;
634+ }
Original file line number Diff line number Diff line change 11export interface RouteDefaults {
2- [ index : string ] : string ;
2+ [ index : string ] : string | null ;
33}
44
55export interface RouteRequirements {
Original file line number Diff line number Diff line change 11export interface RouteDefaults {
2- [ index : string ] : string ;
2+ [ index : string ] : string | null ;
33}
44export interface RouteRequirements {
55 [ index : string ] : string ;
You can’t perform that action at this time.
0 commit comments