mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
feat: Implement currencies formatter for saved metrics (#24517)
This commit is contained in:
committed by
GitHub
parent
e402c94a9f
commit
83ff4cd86a
@@ -158,5 +158,30 @@ describe('BigNumberWithTrendline', () => {
|
||||
'1.23',
|
||||
);
|
||||
});
|
||||
|
||||
it('should format with datasource currency', () => {
|
||||
const propsWithDatasource = {
|
||||
...props,
|
||||
datasource: {
|
||||
...props.datasource,
|
||||
currencyFormats: {
|
||||
value: { symbol: 'USD', symbolPosition: 'prefix' },
|
||||
},
|
||||
metrics: [
|
||||
{
|
||||
label: 'value',
|
||||
metric_name: 'value',
|
||||
d3format: '.2f',
|
||||
currency: `{symbol: 'USD', symbolPosition: 'prefix' }`,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const transformed = transformProps(propsWithDatasource);
|
||||
// @ts-ignore
|
||||
expect(transformed.headerFormatter(transformed.bigNumber)).toStrictEqual(
|
||||
'$ 1.23',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user