You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
853 B
35 lines
853 B
7 years ago
|
import { mount } from '@vue/test-utils'
|
||
|
import Dropdown from '..'
|
||
|
|
||
|
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(Dropdown.Button)
|
||
|
const dropdownProps = wrapper.find({ name: 'ADropdown' }).props()
|
||
|
|
||
|
expect('visible' in dropdownProps).toBe(false)
|
||
|
})
|
||
|
})
|