mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(plugins): missing currency on small number format in table chart (#27041)
(cherry picked from commit 6f402991e5)
This commit is contained in:
committed by
Michael S. Molina
parent
648e0a08d6
commit
db56b7fc36
@@ -166,6 +166,48 @@ describe('plugin-chart-table', () => {
|
||||
expect(cells[2]).toHaveTextContent('$ 0');
|
||||
});
|
||||
|
||||
it('render small formatted data with currencies', () => {
|
||||
const props = transformProps({
|
||||
...testData.raw,
|
||||
rawFormData: {
|
||||
...testData.raw.rawFormData,
|
||||
column_config: {
|
||||
num: {
|
||||
d3SmallNumberFormat: '.2r',
|
||||
currencyFormat: { symbol: 'USD', symbolPosition: 'prefix' },
|
||||
},
|
||||
},
|
||||
},
|
||||
queriesData: [
|
||||
{
|
||||
...testData.raw.queriesData[0],
|
||||
data: [
|
||||
{
|
||||
num: 1234,
|
||||
},
|
||||
{
|
||||
num: 0.5,
|
||||
},
|
||||
{
|
||||
num: 0.61234,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
render(
|
||||
ProviderWrapper({
|
||||
children: <TableChart {...props} sticky={false} />,
|
||||
}),
|
||||
);
|
||||
const cells = document.querySelectorAll('td');
|
||||
|
||||
expect(document.querySelectorAll('th')[0]).toHaveTextContent('num');
|
||||
expect(cells[0]).toHaveTextContent('$ 1.23k');
|
||||
expect(cells[1]).toHaveTextContent('$ 0.50');
|
||||
expect(cells[2]).toHaveTextContent('$ 0.61');
|
||||
});
|
||||
|
||||
it('render empty data', () => {
|
||||
wrap.setProps({ ...transformProps(testData.empty), sticky: false });
|
||||
tree = wrap.render();
|
||||
|
||||
Reference in New Issue
Block a user