refactor: Replace react-bootstrap Tabs with Antd Tabs in DashboardBuilder (#11160)

* Replace tabs in DashboardBuilder

* Fix tests

* Fix styling of anchor

* Fix

* Fix cypress test

* Fix tests

* Fix e2e tests

* Use data-tests

* Move tabs styles from superset.less to Emotion

* Restyle tabs in DashboardBuilder

* Test fix

* Fix styling
This commit is contained in:
Kamil Gabryjelski
2020-11-02 22:31:55 +01:00
committed by GitHub
parent 6c6ded139b
commit a874b14a8a
12 changed files with 194 additions and 289 deletions

View File

@@ -22,10 +22,8 @@ import { styledMount as mount } from 'spec/helpers/theming';
import sinon from 'sinon';
import DashboardComponent from 'src/dashboard/containers/DashboardComponent';
import DeleteComponentModal from 'src/dashboard/components/DeleteComponentModal';
import DragDroppable from 'src/dashboard/components/dnd/DragDroppable';
import EditableTitle from 'src/components/EditableTitle';
import WithPopoverMenu from 'src/dashboard/components/menu/WithPopoverMenu';
import Tab, {
RENDER_TAB,
RENDER_TAB_CONTENT,
@@ -96,42 +94,6 @@ describe('Tabs', () => {
'New title',
);
});
it('should render a WithPopoverMenu', () => {
const wrapper = setup();
expect(wrapper.find(WithPopoverMenu)).toExist();
});
it('should render a DeleteComponentModal when focused if its not the only tab', () => {
let wrapper = setup();
wrapper.find(WithPopoverMenu).simulate('click'); // focus
expect(wrapper.find(DeleteComponentModal)).not.toExist();
wrapper = setup({ editMode: true });
wrapper.find(WithPopoverMenu).simulate('click');
expect(wrapper.find(DeleteComponentModal)).toExist();
wrapper = setup({
editMode: true,
parentComponent: {
...props.parentComponent,
children: props.parentComponent.children.slice(0, 1),
},
});
wrapper.find(WithPopoverMenu).simulate('click');
expect(wrapper.find(DeleteComponentModal)).not.toExist();
});
it('should show modal when clicked delete icon', () => {
const deleteComponent = sinon.spy();
const wrapper = setup({ editMode: true, deleteComponent });
wrapper.find(WithPopoverMenu).simulate('click'); // focus
wrapper.find('.icon-button').simulate('click');
const modal = document.getElementsByClassName('ant-modal');
expect(modal).toHaveLength(1);
expect(deleteComponent.callCount).toBe(0);
});
});
describe('renderType=RENDER_TAB_CONTENT', () => {