mirror of
https://github.com/apache/superset.git
synced 2026-04-07 18:35:15 +00:00
fix(FilterBox): treat empty defaultValues as null (#13109)
* fix(FilterBox): treat empty defaultValues as null * Add a unit test and move constant around
This commit is contained in:
@@ -56,13 +56,25 @@ describe('getFilterConfigsFromFormdata', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should use default value from form_data', () => {
|
||||
it('should use default value and treat empty defaults as null', () => {
|
||||
const result = getFilterConfigsFromFormdata({
|
||||
...testFormdata,
|
||||
show_sqla_time_column: true,
|
||||
filter_configs: [
|
||||
...testFormdata.filter_configs,
|
||||
{
|
||||
asc: false,
|
||||
clearable: true,
|
||||
column: 'country',
|
||||
defaultValue: '',
|
||||
key: 'foo',
|
||||
multiple: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(result.columns).toMatchObject({
|
||||
state: ['CA'],
|
||||
country: null,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user