mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-04 13:08:48 +08:00
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
import { mount } from '@vue/test-utils';
|
|
import Dropdown from '..';
|
|
import Menu from '../../menu';
|
|
|
|
describe('DropdownButton', () => {
|
|
it('pass appropriate props to Dropdown', () => {
|
|
const props = {
|
|
align: {
|
|
offset: [10, 20],
|
|
},
|
|
disabled: false,
|
|
trigger: ['hover'],
|
|
visible: true,
|
|
};
|
|
|
|
const wrapper = mount(Dropdown.Button, {
|
|
propsData: props,
|
|
listeners: {
|
|
visibleChange: () => {},
|
|
},
|
|
});
|
|
const dropdownProps = wrapper.find({ name: 'ADropdown' }).props();
|
|
|
|
Object.keys(props).forEach(key => {
|
|
expect(dropdownProps[key]).toBe(props[key]);
|
|
});
|
|
});
|
|
|
|
it("don't pass visible to Dropdown if it's not exits", () => {
|
|
const wrapper = mount({
|
|
render() {
|
|
return (
|
|
<Dropdown.Button
|
|
overlay={
|
|
<Menu>
|
|
<Menu.Item>foo</Menu.Item>
|
|
</Menu>
|
|
}
|
|
/>
|
|
);
|
|
},
|
|
});
|
|
const dropdownProps = wrapper.find({ name: 'ADropdown' }).props();
|
|
|
|
expect('visible' in dropdownProps).toBe(false);
|
|
});
|
|
});
|