mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix: optimize mapStateToProps for chart controls (#10264)
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
getFormDataFromControls,
|
||||
applyMapStateToPropsToControl,
|
||||
getAllControlsState,
|
||||
getControlsState,
|
||||
} from 'src/explore/controlUtils';
|
||||
|
||||
describe('controlUtils', () => {
|
||||
@@ -246,6 +247,14 @@ describe('controlUtils', () => {
|
||||
const control = getControlState('metrics', 'table', stateWithCount);
|
||||
expect(control.default).toEqual(['count']);
|
||||
});
|
||||
|
||||
it('should not apply mapStateToProps when initializing', () => {
|
||||
const control = getControlState('metrics', 'table', {
|
||||
...state,
|
||||
isInitializing: true,
|
||||
});
|
||||
expect(control.default).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('validateControl', () => {
|
||||
|
||||
@@ -199,7 +199,6 @@ describe('ExploreResultsButton', () => {
|
||||
const calls = fetchMock.calls(visualizeEndpoint);
|
||||
expect(calls).toHaveLength(1);
|
||||
const formData = calls[0][1].body;
|
||||
|
||||
Object.keys(mockOptions).forEach(key => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
expect(formData.get(key)).toBeDefined();
|
||||
|
||||
Reference in New Issue
Block a user