mirror of
https://github.com/apache/superset.git
synced 2026-04-11 20:37:16 +00:00
refactor: Use Antd Dropdown instead of react-bootstrap in DatasourceControl (#11395)
* Create Tooltip component * Refactor DatasourceControl * Bug fix * Lint fix * E2E test fix * Move menu item keys to constants * Remove LESS file * Test fix * Test fix * Lint fix
This commit is contained in:
committed by
GitHub
parent
6f69212f28
commit
ad88a06d61
@@ -20,7 +20,7 @@ import React from 'react';
|
||||
import sinon from 'sinon';
|
||||
import configureStore from 'redux-mock-store';
|
||||
import { shallow } from 'enzyme';
|
||||
import { MenuItem } from 'react-bootstrap';
|
||||
import { Menu } from 'src/common/components';
|
||||
import DatasourceModal from 'src/datasource/DatasourceModal';
|
||||
import ChangeDatasourceModal from 'src/datasource/ChangeDatasourceModal';
|
||||
import DatasourceControl from 'src/explore/components/controls/DatasourceControl';
|
||||
@@ -72,17 +72,23 @@ describe('DatasourceControl', () => {
|
||||
|
||||
it('show or hide Edit Datasource option', () => {
|
||||
let wrapper = setup();
|
||||
expect(wrapper.find('#datasource_menu')).toExist();
|
||||
expect(wrapper.find('#datasource_menu').dive().find(MenuItem)).toHaveLength(
|
||||
3,
|
||||
expect(wrapper.find('[data-test="datasource-menu"]')).toExist();
|
||||
let menuWrapper = shallow(
|
||||
<div>
|
||||
{wrapper.find('[data-test="datasource-menu"]').prop('overlay')}
|
||||
</div>,
|
||||
);
|
||||
expect(menuWrapper.find(Menu.Item)).toHaveLength(3);
|
||||
|
||||
wrapper = setup({
|
||||
isEditable: false,
|
||||
});
|
||||
expect(wrapper.find('#datasource_menu')).toExist();
|
||||
expect(wrapper.find('#datasource_menu').dive().find(MenuItem)).toHaveLength(
|
||||
2,
|
||||
expect(wrapper.find('[data-test="datasource-menu"]')).toExist();
|
||||
menuWrapper = shallow(
|
||||
<div>
|
||||
{wrapper.find('[data-test="datasource-menu"]').prop('overlay')}
|
||||
</div>,
|
||||
);
|
||||
expect(menuWrapper.find(Menu.Item)).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user