@@ -21,18 +21,26 @@ describe('replaceVariablesPlaceholdersByVariableName', () => {
2121} )
2222
2323describe ( 'replaceDriversPlaceholdersByDriverUrlName' , ( ) => {
24- const drivers = [ { name : 'Country' , urlName : 'country' , value : 'Italy' , type : 'STRING' , multivalue : false , visible : true , driverLabel : 'COUNTRY' } ] as any [ ]
24+ const drivers = [ { name : 'Country' , urlName : 'country' , value : 'IT' , description : ' Italy', type : 'STRING' , multivalue : false , visible : true , driverLabel : 'COUNTRY' } ] as any [ ]
2525
2626 it ( 'replaces a driver placeholder using the urlName' , ( ) => {
27- expect ( replaceDriversPlaceholdersByDriverUrlName ( 'Country: $P{country}' , drivers ) ) . toBe ( 'Country: Italy' )
27+ expect ( replaceDriversPlaceholdersByDriverUrlName ( 'Country: $P{country}' , drivers ) ) . toBe ( 'Country: IT' )
28+ } )
29+
30+ it ( 'replaces a driver description placeholder using the urlName' , ( ) => {
31+ expect ( replaceDriversPlaceholdersByDriverUrlName ( 'Country: $P{country_description}' , drivers ) ) . toBe ( 'Country: Italy' )
2832 } )
2933} )
3034
3135describe ( 'replaceVariablesAndDriversPlaceholders' , ( ) => {
3236 const variables = [ { name : 'Year' , value : '2024' , type : 'static' } ] as any [ ]
33- const drivers = [ { name : 'Country' , urlName : 'country' , value : 'Italy' , type : 'STRING' , multivalue : false , visible : true , driverLabel : 'COUNTRY' } ] as any [ ]
37+ const drivers = [ { name : 'Country' , urlName : 'country' , value : 'IT' , description : ' Italy', type : 'STRING' , multivalue : false , visible : true , driverLabel : 'COUNTRY' } ] as any [ ]
3438
3539 it ( 'resolves mixed static text, variables and document parameters in the same title' , ( ) => {
36- expect ( replaceVariablesAndDriversPlaceholders ( 'Sales $V{Year} - $P{country}' , variables , drivers ) ) . toBe ( 'Sales 2024 - Italy' )
40+ expect ( replaceVariablesAndDriversPlaceholders ( 'Sales $V{Year} - $P{country}' , variables , drivers ) ) . toBe ( 'Sales 2024 - IT' )
41+ } )
42+
43+ it ( 'resolves parameter description placeholders in widget titles' , ( ) => {
44+ expect ( replaceVariablesAndDriversPlaceholders ( 'Sales $V{Year} - $P{country_description}' , variables , drivers ) ) . toBe ( 'Sales 2024 - Italy' )
3745 } )
3846} )
0 commit comments