import React from 'react'; import DropdownButton from '../dropdown-button'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; import Menu from '../../menu'; import type { DropdownProps } from '../dropdown'; import { render } from '../../../tests/utils'; let dropdownProps: DropdownProps; jest.mock('../dropdown', () => { const ActualDropdown = jest.requireActual('../dropdown'); const ActualDropdownComponent = ActualDropdown.default; const h: typeof React = jest.requireActual('react'); const mockedDropdown = (props: DropdownProps) => { dropdownProps = props; const { children, ...restProps } = props; return h.createElement(ActualDropdownComponent, { ...restProps }, children); }; mockedDropdown.defaultProps = ActualDropdownComponent.defaultProps; mockedDropdown.Button = ActualDropdownComponent.Button; return { ...ActualDropdown, __esModule: true, default: mockedDropdown, }; }); describe('DropdownButton', () => { mountTest(DropdownButton); rtlTest(DropdownButton); it('pass appropriate props to Dropdown', () => { const props: DropdownProps = { align: { offset: [10, 20], }, overlay: (
), disabled: false, trigger: ['hover'], visible: true, onVisibleChange: () => {}, }; render(