fix(Field): should not display null (#6542)

This commit is contained in:
neverland 2020-06-15 17:42:21 +08:00 committed by GitHub
parent 4b786cdba3
commit 700a0f23f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -280,7 +280,7 @@ export default createComponent({
},
updateValue(value) {
value = String(value);
value = isDef(value) ? String(value) : '';
if (value === this.currentValue) {
return;

View File

@ -380,3 +380,14 @@ test('should blur search input on enter', () => {
wrapper.find('input').trigger('keypress.enter');
expect(wrapper.emitted('blur')).toBeTruthy();
});
test('value is null', () => {
const wrapper = mount(Field, {
propsData: {
value: null,
},
});
expect(wrapper.find('input').element.value).toEqual('');
expect(wrapper.emitted('input')[0][0]).toEqual('');
});