mirror of
https://github.com/apache/superset.git
synced 2024-09-06 22:07:34 -04:00
fix(explore): fix y-axis lower bound 0 value (#15091)
This commit is contained in:
parent
8e6a5a6f52
commit
856a2bd5ed
@ -51,3 +51,12 @@ test('calls onChange with correct values', async () => {
|
||||
expect(defaultProps.onChange).toHaveBeenLastCalledWith([1, 2]),
|
||||
);
|
||||
});
|
||||
|
||||
test('receives 0 value', async () => {
|
||||
render(<BoundsControl {...defaultProps} />);
|
||||
const minInput = screen.getAllByRole('spinbutton')[0];
|
||||
userEvent.type(minInput, '0');
|
||||
await waitFor(() =>
|
||||
expect(defaultProps.onChange).toHaveBeenLastCalledWith([0, null]),
|
||||
);
|
||||
});
|
||||
|
@ -97,8 +97,8 @@ export default class BoundsControl extends React.Component {
|
||||
|
||||
onChange() {
|
||||
const mm = this.state.minMax;
|
||||
const min = parseFloat(mm[0]) || null;
|
||||
const max = parseFloat(mm[1]) || null;
|
||||
const min = Number.isNaN(parseFloat(mm[0])) ? null : parseFloat(mm[0]);
|
||||
const max = Number.isNaN(parseFloat(mm[1])) ? null : parseFloat(mm[1]);
|
||||
this.props.onChange([min, max]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user