feat(AddressEdit): add tel-maxlength prop (#6869)

This commit is contained in:
neverland
2020-07-25 10:36:45 +08:00
committed by GitHub
parent b7a7e48eea
commit 08a554c5a2
4 changed files with 21 additions and 3 deletions
+15 -1
View File
@@ -1,6 +1,6 @@
import AddressEdit from '..';
import areaList from '../../area/demo/area-simple';
import { mount, later } from '../../../test';
import { mount, later, trigger } from '../../../test';
const addressInfo = {
name: '测试',
@@ -306,3 +306,17 @@ test('click-area event', () => {
field.trigger('click');
expect(wrapper.emitted('click-area')[0]).toBeTruthy();
});
test('tel-maxlength prop', () => {
const wrapper = mount(AddressEdit, {
propsData: {
telMaxlength: 4,
},
});
const telInput = wrapper.find('input[type="tel"]');
telInput.element.value = '123456';
trigger(telInput, 'input');
expect(telInput.element.value).toEqual('1234');
});