mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-28 20:25:29 +08:00
test(button-dropdown): test event when callback missing
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user