mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(bar_chart): Stacked Bar chart with Time comparison in separated stacks (#27589)
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
||||
sanitizeHtml,
|
||||
sortAndFilterSeries,
|
||||
sortRows,
|
||||
getTimeCompareStackId,
|
||||
} from '../../src/utils/series';
|
||||
import {
|
||||
EchartsTimeseriesSeriesType,
|
||||
@@ -1041,3 +1042,33 @@ test('getMinAndMaxFromBounds returns automatic lower bound when truncating', ()
|
||||
scale: true,
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTimeCompareStackId', () => {
|
||||
it('returns the defaultId when timeCompare is empty', () => {
|
||||
const result = getTimeCompareStackId('default', []);
|
||||
expect(result).toEqual('default');
|
||||
});
|
||||
|
||||
it('returns the defaultId when no value in timeCompare is included in name', () => {
|
||||
const result = getTimeCompareStackId(
|
||||
'default',
|
||||
['compare1', 'compare2'],
|
||||
'test__name',
|
||||
);
|
||||
expect(result).toEqual('default');
|
||||
});
|
||||
|
||||
it('returns the first value in timeCompare that is included in name', () => {
|
||||
const result = getTimeCompareStackId(
|
||||
'default',
|
||||
['compare1', 'compare2'],
|
||||
'test__compare1',
|
||||
);
|
||||
expect(result).toEqual('compare1');
|
||||
});
|
||||
|
||||
it('handles name being a number', () => {
|
||||
const result = getTimeCompareStackId('default', ['123', '456'], 123);
|
||||
expect(result).toEqual('123');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user