feat(AddressEdit): add new event click-area (#5939)

This commit is contained in:
rex 2020-03-29 06:45:59 +08:00 committed by GitHub
parent ed28f808b2
commit 6ee5448b35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -297,6 +297,7 @@ export default createComponent({
value={this.areaText}
onFocus={onFocus('areaCode')}
onClick={() => {
this.$emit('click-area');
this.showAreaPopup = !disableArea;
}}
/>

View File

@ -294,3 +294,15 @@ test('select area', () => {
wrapper.find('.van-picker__confirm').trigger('click');
expect(data.areaCode).toEqual('110101');
});
test('click-area event', () => {
const wrapper = mount(AddressEdit, {
propsData: {
disableArea: true,
},
});
const field = wrapper.findAll('.van-field').at(2);
field.trigger('click');
expect(wrapper.emitted('click-area')[0]).toBeTruthy();
});