Migrates DropdownButton component from Bootstrap to AntD (#13002)

This commit is contained in:
Michael S. Molina
2021-02-18 15:14:21 -03:00
committed by GitHub
parent 9489f0b8f4
commit 9335b9c983
8 changed files with 95 additions and 91 deletions

View File

@@ -17,10 +17,9 @@
* under the License.
*/
import React from 'react';
import { mount } from 'enzyme';
import { mount, shallow } from 'enzyme';
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
import { Menu } from 'src/common/components';
import ModalTrigger from 'src/components/ModalTrigger';
import { Dropdown, Menu } from 'src/common/components';
import { DisplayQueryButton } from 'src/explore/components/DisplayQueryButton';
describe('DisplayQueryButton', () => {
@@ -43,14 +42,16 @@ describe('DisplayQueryButton', () => {
true,
);
});
it('renders a dropdown', () => {
it('renders a dropdown with 3 itens', () => {
const wrapper = mount(<DisplayQueryButton {...defaultProps} />, {
wrappingComponent: ThemeProvider,
wrappingComponentProps: {
theme: supersetTheme,
},
});
expect(wrapper.find(ModalTrigger)).toHaveLength(1);
expect(wrapper.find(Menu.Item)).toHaveLength(3);
const dropdown = wrapper.find(Dropdown);
const menu = shallow(<div>{dropdown.prop('overlay')}</div>);
const menuItems = menu.find(Menu.Item);
expect(menuItems).toHaveLength(3);
});
});