[revert] Field: shouldn't emit click event when click icon (#3772) (#3776)

This commit is contained in:
neverland 2019-07-08 16:30:14 +08:00 committed by GitHub
parent be96fa2233
commit 968ec97256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 3 deletions

View File

@ -148,12 +148,10 @@ export default createComponent({
}, },
onClickLeftIcon(event) { onClickLeftIcon(event) {
event.stopPropagation();
this.$emit('click-left-icon', event); this.$emit('click-left-icon', event);
}, },
onClickRightIcon(event) { onClickRightIcon(event) {
event.stopPropagation();
this.$emit('click-right-icon', event); this.$emit('click-right-icon', event);
}, },

View File

@ -28,7 +28,7 @@ test('click icon event', () => {
wrapper.find('.van-field__left-icon').trigger('click'); wrapper.find('.van-field__left-icon').trigger('click');
wrapper.find('.van-field__right-icon').trigger('click'); wrapper.find('.van-field__right-icon').trigger('click');
expect(wrapper.emitted('click')).toBeFalsy(); expect(wrapper.emitted('click').length).toEqual(2);
expect(wrapper.emitted('click-left-icon')[0][0]).toBeTruthy(); expect(wrapper.emitted('click-left-icon')[0][0]).toBeTruthy();
expect(wrapper.emitted('click-right-icon')[0][0]).toBeTruthy(); expect(wrapper.emitted('click-right-icon')[0][0]).toBeTruthy();
}); });