mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
fix(Field): should not display null (#6542)
This commit is contained in:
@@ -280,7 +280,7 @@ export default createComponent({
|
||||
},
|
||||
|
||||
updateValue(value) {
|
||||
value = String(value);
|
||||
value = isDef(value) ? String(value) : '';
|
||||
|
||||
if (value === this.currentValue) {
|
||||
return;
|
||||
|
@@ -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('');
|
||||
});
|
||||
|
Reference in New Issue
Block a user