mirror of
https://github.com/apache/superset.git
synced 2024-09-19 20:19:37 -04:00
fix(legacy-plugin-chart-table): parse numeric pageLength (#522)
This commit is contained in:
parent
8776262499
commit
6d04279daf
@ -138,7 +138,7 @@ export default function transformProps(chartProps: TableChartProps): DataTablePr
|
||||
showCellBars,
|
||||
includeSearch,
|
||||
orderDesc,
|
||||
pageLength: typeof pageLength === 'string' ? parseInt(pageLength, 10) || 0 : 0,
|
||||
pageLength: typeof pageLength === 'string' ? parseInt(pageLength, 10) || 0 : pageLength,
|
||||
tableTimestampFormat,
|
||||
filters,
|
||||
emitFilter: tableFilter === true,
|
||||
|
@ -24,7 +24,23 @@ import testData from './testData';
|
||||
|
||||
describe('legacy-table', () => {
|
||||
// Can test more prop transformation here. Not needed for now.
|
||||
describe('transformProps', () => {});
|
||||
describe('transformProps', () => {
|
||||
it('should parse pageLength', () => {
|
||||
expect(transformProps(testData.basic).pageLength).toBe(20);
|
||||
expect(
|
||||
transformProps({
|
||||
...testData.basic,
|
||||
formData: { ...testData.basic.formData, pageLength: '20' },
|
||||
}).pageLength,
|
||||
).toBe(20);
|
||||
expect(
|
||||
transformProps({
|
||||
...testData.basic,
|
||||
formData: { ...testData.basic.formData, pageLength: '' },
|
||||
}).pageLength,
|
||||
).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ReactDataTable', () => {
|
||||
let wrap: CommonWrapper; // the ReactDataTable wraper
|
||||
|
@ -26,7 +26,7 @@ const basicFormData = {
|
||||
showCellBars: true,
|
||||
includeSearch: false,
|
||||
orderDesc: true,
|
||||
pageLength: 0,
|
||||
pageLength: 20,
|
||||
metrics: [],
|
||||
percentMetrics: null,
|
||||
timeseriesLimitMetric: null,
|
||||
|
Loading…
Reference in New Issue
Block a user