test(button-dropdown): test event when callback missing

This commit is contained in:
unix
2020-04-16 09:56:18 +08:00
parent f322fd02d9
commit fede6fc6aa

View File

@@ -50,6 +50,17 @@ describe('Button Dropdown', () => {
expect(wrapper.text()).toContain('state2')
})
it('should work correctly when callback missing', () => {
const wrapper = mount(
<ButtonDropdown type="secondary">
<ButtonDropdown.Item main>
</ButtonDropdown.Item>
</ButtonDropdown>
)
wrapper.find('button').simulate('click', nativeEvent)
expect(() => wrapper.unmount()).not.toThrow()
})
it('should ignore all events when loading', () => {
const Wrapper = () => {
const [state, setState] = React.useState<string>('state1')