chore: add trailingComma

This commit is contained in:
陈嘉涵
2020-01-19 11:57:09 +08:00
parent e841175fe8
commit 389d68884d
269 changed files with 2706 additions and 2702 deletions
+4 -4
View File
@@ -221,7 +221,7 @@ export default {
numberPlaceholder: 'Number',
messagePlaceholder: 'Message',
alignPlaceHolder: 'Input Align Right',
}
},
},
data() {
@@ -240,15 +240,15 @@ export default {
message2: '',
phone: '',
phone2: '12345',
formatValue: ''
formatValue: '',
};
},
methods: {
formatter(value) {
return value.replace(/\d/g, '');
}
}
},
},
};
</script>
+15 -15
View File
@@ -33,20 +33,20 @@ export default createComponent({
showWordLimit: Boolean,
type: {
type: String,
default: 'text'
}
default: 'text',
},
},
data() {
return {
focused: false
focused: false,
};
},
watch: {
value() {
this.$nextTick(this.adjustSize);
}
},
},
mounted() {
@@ -71,7 +71,7 @@ export default createComponent({
input: this.onInput,
keypress: this.onKeypress,
focus: this.onFocus,
blur: this.onBlur
blur: this.onBlur,
};
delete listeners.click;
@@ -84,7 +84,7 @@ export default createComponent({
if (labelWidth) {
return { width: addUnit(labelWidth) };
}
}
},
},
methods: {
@@ -230,22 +230,22 @@ export default createComponent({
ref: 'input',
class: bem('control', this.inputAlign),
domProps: {
value: this.value
value: this.value,
},
attrs: {
...this.$attrs,
disabled: this.disabled,
readonly: this.readonly,
placeholder: this.placeholder
placeholder: this.placeholder,
},
on: this.listeners,
// add model directive to skip IME composition
directives: [
{
name: 'model',
value: this.value
}
]
value: this.value,
},
],
};
if (type === 'textarea') {
@@ -306,14 +306,14 @@ export default createComponent({
</div>
);
}
}
},
},
render() {
const { slots, labelAlign } = this;
const scopedSlots = {
icon: this.genLeftIcon
icon: this.genLeftIcon,
};
if (slots('label')) {
@@ -336,7 +336,7 @@ export default createComponent({
class={bem({
error: this.error,
[`label-${labelAlign}`]: labelAlign,
'min-height': this.type === 'textarea' && !this.autosize
'min-height': this.type === 'textarea' && !this.autosize,
})}
scopedSlots={scopedSlots}
onClick={this.onClick}
@@ -363,5 +363,5 @@ export default createComponent({
)}
</Cell>
);
}
},
});
+34 -34
View File
@@ -22,8 +22,8 @@ test('click icon event', () => {
propsData: {
value: 'a',
leftIcon: 'contact',
rightIcon: 'search'
}
rightIcon: 'search',
},
});
wrapper.find('.van-field__left-icon').trigger('click');
@@ -37,8 +37,8 @@ test('number type', () => {
const wrapper = mount(Field, {
propsData: {
value: '',
type: 'number'
}
type: 'number',
},
});
const input = wrapper.find('input');
@@ -60,8 +60,8 @@ test('digit type', () => {
const wrapper = mount(Field, {
propsData: {
value: '',
type: 'digit'
}
type: 'digit',
},
});
const input = wrapper.find('input');
@@ -83,8 +83,8 @@ test('render textarea', async () => {
const wrapper = mount(Field, {
propsData: {
type: 'textarea',
autosize: true
}
autosize: true,
},
});
await later();
@@ -95,8 +95,8 @@ test('autosize textarea field', () => {
const wrapper = mount(Field, {
propsData: {
type: 'textarea',
autosize: {}
}
autosize: {},
},
});
const value = '1'.repeat(20);
@@ -112,9 +112,9 @@ test('autosize object', async () => {
type: 'textarea',
autosize: {
maxHeight: 100,
minHeight: 50
}
}
minHeight: 50,
},
},
});
const textarea = wrapper.find('.van-field__control');
@@ -147,12 +147,12 @@ test('focus method', () => {
test('maxlength', async () => {
const wrapper = mount(Field, {
attrs: {
maxlength: 3
maxlength: 3,
},
propsData: {
value: 1234,
type: 'number'
}
type: 'number',
},
});
const input = wrapper.find('input');
@@ -170,8 +170,8 @@ test('clearable', () => {
const wrapper = mount(Field, {
propsData: {
value: 'test',
clearable: true
}
clearable: true,
},
});
expect(wrapper).toMatchSnapshot();
@@ -192,8 +192,8 @@ test('render input slot', () => {
</field>
`,
components: {
Field
}
Field,
},
});
expect(wrapper).toMatchSnapshot();
@@ -207,8 +207,8 @@ test('render label slot', () => {
</field>
`,
components: {
Field
}
Field,
},
});
expect(wrapper).toMatchSnapshot();
@@ -217,8 +217,8 @@ test('render label slot', () => {
test('size prop', () => {
const wrapper = mount(Field, {
propsData: {
size: 'large'
}
size: 'large',
},
});
expect(wrapper).toMatchSnapshot();
});
@@ -227,8 +227,8 @@ test('label-width prop with unit', () => {
const wrapper = mount(Field, {
propsData: {
label: 'Label',
labelWidth: '10rem'
}
labelWidth: '10rem',
},
});
expect(wrapper).toMatchSnapshot();
});
@@ -237,8 +237,8 @@ test('label-width prop without unit', () => {
const wrapper = mount(Field, {
propsData: {
label: 'Label',
labelWidth: 100
}
labelWidth: 100,
},
});
expect(wrapper).toMatchSnapshot();
});
@@ -247,8 +247,8 @@ test('label-class prop', () => {
const wrapper = mount(Field, {
propsData: {
label: 'Label',
labelClass: 'custom-label-class'
}
labelClass: 'custom-label-class',
},
});
expect(wrapper).toMatchSnapshot();
});
@@ -257,8 +257,8 @@ test('arrow-direction prop', () => {
const wrapper = mount(Field, {
propsData: {
isLink: true,
arrowDirection: 'up'
}
arrowDirection: 'up',
},
});
expect(wrapper).toMatchSnapshot();
});
@@ -267,8 +267,8 @@ test('formatter prop', () => {
const wrapper = mount(Field, {
propsData: {
value: 'abc123',
formatter: (value) => value.replace(/\d/g, '')
}
formatter: (value) => value.replace(/\d/g, ''),
},
});
const input = wrapper.find('input');