[bugfix] Field: maxlength not work when type = number (#1839)

This commit is contained in:
neverland
2018-09-20 21:15:52 +08:00
committed by GitHub
parent 4c7c2d7b76
commit efa264d612
2 changed files with 37 additions and 1 deletions
+22
View File
@@ -109,3 +109,25 @@ test('blur method', () => {
expect(fn.mock.calls.length).toEqual(1);
});
test('maxlength', async() => {
const wrapper = mount(Field, {
attrs: {
maxlength: 3
},
propsData: {
value: 1234,
type: 'number'
}
});
const input = wrapper.find('input');
expect(input.element.value).toEqual('123');
input.element.value = 1234;
await later();
input.trigger('input');
expect(input.element.value).toEqual('123');
expect(wrapper.emitted('input')[0][0]).toEqual('123');
});