refactor: Replace react-bootstrap Modals with Antd in Explore (#11389)

* VizTypeControl

* SaveModal

* explore/PropertiesModal

* Fix e2e tests

* Remove console logs

* Fix tests

* Fix test

* Fix e2e test

* Remove unnecessary fragment

* Fix e2e tests

* Fix e2e test
This commit is contained in:
Kamil Gabryjelski
2020-11-02 08:04:53 +01:00
committed by GitHub
parent 854a4614a8
commit 19f2deb27f
7 changed files with 205 additions and 211 deletions

View File

@@ -23,11 +23,12 @@ import { bindActionCreators } from 'redux';
import { shallow } from 'enzyme';
import { styledMount as mount } from 'spec/helpers/theming';
import { FormControl, Modal, Radio } from 'react-bootstrap';
import { FormControl, Radio } from 'react-bootstrap';
import Button from 'src/components/Button';
import sinon from 'sinon';
import fetchMock from 'fetch-mock';
import Modal from 'src/common/components/Modal';
import * as exploreUtils from 'src/explore/exploreUtils';
import * as saveModalActions from 'src/explore/actions/saveModalActions';
import SaveModal from 'src/explore/components/SaveModal';
@@ -79,8 +80,10 @@ describe('SaveModal', () => {
const wrapper = getWrapper();
expect(wrapper.find(Modal)).toExist();
expect(wrapper.find(FormControl)).toExist();
expect(wrapper.find(Button)).toHaveLength(3);
expect(wrapper.find(Radio)).toHaveLength(2);
const footerWrapper = shallow(wrapper.find('Modal').props().footer);
expect(footerWrapper.find(Button)).toHaveLength(3);
});
it('overwrite radio button is disabled for new slice', () => {

View File

@@ -19,9 +19,9 @@
import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { Modal } from 'react-bootstrap';
import { getChartMetadataRegistry, ChartMetadata } from '@superset-ui/core';
import VizTypeControl from 'src/explore/components/controls/VizTypeControl';
import Modal from 'src/common/components/Modal';
const defaultProps = {
name: 'viz_type',
@@ -65,7 +65,11 @@ describe('VizTypeControl', () => {
});
it('filters images based on text input', () => {
expect(wrapper.find('img')).toHaveLength(2);
wrapper.setState({ filter: 'vis2' });
wrapper.find('FormControl').simulate('change', {
target: {
value: 'vis2',
},
});
expect(wrapper.find('img')).toExist();
});
});