feat: Add controlGroups to formData (#9740)

This commit is contained in:
Ville Brofeldt
2020-05-06 14:53:13 +03:00
committed by GitHub
parent 453806fc4c
commit 5485eb993c
3 changed files with 19 additions and 1 deletions

View File

@@ -23,7 +23,9 @@ import { t } from '@superset-ui/translation';
import {
getControlConfig,
getControlState,
getFormDataFromControls,
applyMapStateToPropsToControl,
getAllControlsState,
} from '../../../src/explore/controlUtils';
import ColumnOption from '../../../src/components/ColumnOption';
@@ -107,6 +109,7 @@ describe('controlUtils', () => {
name: 'all_columns',
config: {
type: 'SelectControl',
controlGroup: 'columns',
multi: true,
label: t('Columns'),
default: [],
@@ -246,4 +249,12 @@ describe('controlUtils', () => {
expect(control.validationErrors).toEqual(['cannot be empty']);
});
});
describe('controlGroup', () => {
it('in formData', () => {
const controlsState = getAllControlsState('table', 'table', {}, {});
const formData = getFormDataFromControls(controlsState);
expect(formData.controlGroups).toEqual({ all_columns: 'columns' });
});
});
});