diff --git a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx
index 4383075ded..589ef9173a 100644
--- a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx
+++ b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/TimeSeriesColumnControl.test.tsx
@@ -21,7 +21,11 @@ import { render, screen } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
import TimeSeriesColumnControl from '.';
-jest.mock('lodash/debounce', () => jest.fn(fn => fn));
+jest.mock('lodash/debounce', () => (fn: Function & { cancel: Function }) => {
+ // eslint-disable-next-line no-param-reassign
+ fn.cancel = jest.fn();
+ return fn;
+});
test('renders with default props', () => {
render();
@@ -78,7 +82,7 @@ test('triggers onChange when type changes', () => {
const onChange = jest.fn();
render();
userEvent.click(screen.getByRole('button'));
- userEvent.click(screen.getByText('Select...'));
+ userEvent.click(screen.getByText('Select ...'));
userEvent.click(screen.getByText('Time comparison'));
expect(onChange).not.toHaveBeenCalled();
userEvent.click(screen.getByRole('button', { name: 'Save' }));
@@ -121,7 +125,7 @@ test('triggers onChange when time type changes', () => {
const onChange = jest.fn();
render();
userEvent.click(screen.getByRole('button'));
- userEvent.click(screen.getByText('Select...'));
+ userEvent.click(screen.getByText('Select ...'));
userEvent.click(screen.getByText('Difference'));
expect(onChange).not.toHaveBeenCalled();
userEvent.click(screen.getByRole('button', { name: 'Save' }));
diff --git a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx
index aef39a4a4c..6f4585bdae 100644
--- a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx
+++ b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx
@@ -21,7 +21,7 @@ import PropTypes from 'prop-types';
import { Row, Col, Input } from 'src/common/components';
import Button from 'src/components/Button';
import Popover from 'src/components/Popover';
-import Select from 'src/components/Select';
+import { Select } from 'src/components';
import { t, styled } from '@superset-ui/core';
import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls';
import BoundsControl from '../BoundsControl';
@@ -61,17 +61,17 @@ const defaultProps = {
};
const comparisonTypeOptions = [
- { value: 'value', label: 'Actual value' },
- { value: 'diff', label: 'Difference' },
- { value: 'perc', label: 'Percentage' },
- { value: 'perc_change', label: 'Percentage change' },
+ { value: 'value', label: 'Actual value', key: 'value' },
+ { value: 'diff', label: 'Difference', key: 'diff' },
+ { value: 'perc', label: 'Percentage', key: 'perc' },
+ { value: 'perc_change', label: 'Percentage change', key: 'perc_change' },
];
const colTypeOptions = [
- { value: 'time', label: 'Time comparison' },
- { value: 'contrib', label: 'Contribution' },
- { value: 'spark', label: 'Sparkline' },
- { value: 'avg', label: 'Period average' },
+ { value: 'time', label: 'Time comparison', key: 'time' },
+ { value: 'contrib', label: 'Contribution', key: 'contrib' },
+ { value: 'spark', label: 'Sparkline', key: 'spark' },
+ { value: 'avg', label: 'Period average', key: 'avg' },
];
const StyledRow = styled(Row)`
@@ -143,7 +143,7 @@ export default class TimeSeriesColumnControl extends React.Component {
}
onSelectChange(attr, opt) {
- this.setState({ [attr]: opt.value });
+ this.setState({ [attr]: opt });
}
onTextInputChange(attr, event) {
@@ -216,8 +216,8 @@ export default class TimeSeriesColumnControl extends React.Component {
'Type of comparison, value difference or percentage',
'col-type',
,
@@ -273,8 +273,8 @@ export default class TimeSeriesColumnControl extends React.Component {
'Type of comparison, value difference or percentage',
'comp-type',
,