mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-19 20:08:43 +08:00
30 lines
721 B
JavaScript
30 lines
721 B
JavaScript
|
import React from 'react';
|
||
|
import { shallow } from 'enzyme';
|
||
|
import Dropdown from '../../components/dropdown';
|
||
|
import Menu from '../../components/menu';
|
||
|
|
||
|
describe('DropdownButton', () => {
|
||
|
it('pass appropriate props to Dropdown', () => {
|
||
|
const props = {
|
||
|
align: {
|
||
|
offset: [10, 20],
|
||
|
},
|
||
|
overlay: (
|
||
|
<Menu>
|
||
|
<Menu.Item>foo</Menu.Item>
|
||
|
</Menu>
|
||
|
),
|
||
|
trigger: ['hover'],
|
||
|
visible: true,
|
||
|
onVisibleChange: () => {},
|
||
|
};
|
||
|
|
||
|
const wrapper = shallow(<Dropdown.Button {...props} />);
|
||
|
const dropdownProps = wrapper.find(Dropdown).props();
|
||
|
|
||
|
Object.keys(props).forEach(key => {
|
||
|
expect(dropdownProps[key]).toBe(props[key]);
|
||
|
});
|
||
|
});
|
||
|
});
|