mirror of
https://github.com/apache/superset.git
synced 2026-04-17 15:15:20 +00:00
refactor: Bootstrap to AntD - Form - iteration 3 (#14502)
This commit is contained in:
committed by
GitHub
parent
4f000cc8d1
commit
79ff96269b
@@ -20,7 +20,7 @@
|
||||
import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import { shallow } from 'enzyme';
|
||||
import { FormGroup } from 'react-bootstrap';
|
||||
import { FormItem } from 'src/components/Form';
|
||||
import Button from 'src/components/Button';
|
||||
|
||||
import { AGGREGATES } from 'src/explore/constants';
|
||||
@@ -67,7 +67,7 @@ function setup(overrides) {
|
||||
describe('AdhocMetricEditPopover', () => {
|
||||
it('renders a popover with edit metric form contents', () => {
|
||||
const { wrapper } = setup();
|
||||
expect(wrapper.find(FormGroup)).toHaveLength(4);
|
||||
expect(wrapper.find(FormItem)).toHaveLength(3);
|
||||
expect(wrapper.find(Button)).toHaveLength(2);
|
||||
});
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { FormControl } from 'react-bootstrap';
|
||||
import sinon from 'sinon';
|
||||
import { styledMount as mount } from 'spec/helpers/theming';
|
||||
import BoundsControl from 'src/explore/components/controls/BoundsControl';
|
||||
import { Input } from 'src/common/components';
|
||||
|
||||
const defaultProps = {
|
||||
name: 'y_axis_bounds',
|
||||
@@ -35,13 +35,13 @@ describe('BoundsControl', () => {
|
||||
wrapper = mount(<BoundsControl {...defaultProps} />);
|
||||
});
|
||||
|
||||
it('renders two FormControls', () => {
|
||||
expect(wrapper.find(FormControl)).toHaveLength(2);
|
||||
it('renders two Input', () => {
|
||||
expect(wrapper.find(Input)).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('errors on non-numeric', () => {
|
||||
wrapper
|
||||
.find(FormControl)
|
||||
.find(Input)
|
||||
.first()
|
||||
.simulate('change', { target: { value: 's' } });
|
||||
expect(defaultProps.onChange.calledWith([null, null])).toBe(true);
|
||||
@@ -51,11 +51,11 @@ describe('BoundsControl', () => {
|
||||
});
|
||||
it('casts to numeric', () => {
|
||||
wrapper
|
||||
.find(FormControl)
|
||||
.find(Input)
|
||||
.first()
|
||||
.simulate('change', { target: { value: '1' } });
|
||||
wrapper
|
||||
.find(FormControl)
|
||||
.find(Input)
|
||||
.last()
|
||||
.simulate('change', { target: { value: '5' } });
|
||||
expect(defaultProps.onChange.calledWith([1, 5])).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user