mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 03:44:48 +00:00
[bugfix] Checkbox: click event untriggered when click icon (#2990)
This commit is contained in:
@@ -70,3 +70,19 @@ test('checkbox group', () => {
|
||||
icons.at(0).trigger('click');
|
||||
expect(wrapper.vm.result).toEqual(['b']);
|
||||
});
|
||||
|
||||
test('click event', () => {
|
||||
const onClick = jest.fn();
|
||||
const wrapper = mount(Checkbox, {
|
||||
listeners: {
|
||||
click: onClick
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.trigger('click');
|
||||
expect(onClick.mock.calls.length).toEqual(1);
|
||||
|
||||
const icon = wrapper.find('.van-checkbox__icon');
|
||||
icon.trigger('click');
|
||||
expect(onClick.mock.calls.length).toEqual(2);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user