form-item sizeClass (#11408)

* form-item sizeClass

* Update form.spec.js
pull/11426/head
Jason Zoo 2018-05-30 18:25:50 +08:00 committed by 杨奕
parent a230e4a0ff
commit dc816832e1
2 changed files with 22 additions and 1 deletions

View File

@ -156,7 +156,7 @@
return this.size || this._formSize; return this.size || this._formSize;
}, },
sizeClass() { sizeClass() {
return (this.$ELEMENT || {}).size || this.elFormItemSize; return this.elFormItemSize || (this.$ELEMENT || {}).size;
} }
}, },
data() { data() {

View File

@ -102,6 +102,27 @@ describe('Form', () => {
expect(vm.$refs.labelLeft.$el.classList.contains('el-form--label-left')).to.be.true; expect(vm.$refs.labelLeft.$el.classList.contains('el-form--label-left')).to.be.true;
done(); done();
}); });
it('label size', () => {
vm = createVue({
template: `
<div>
<el-form :model="form" size="mini" ref="labelMini">
<el-form-item>
<el-input v-model="form.name"></el-input>
</el-form-item>
</el-form>
</div>
`,
data() {
return {
form: {
name: ''
}
};
}
}, true);
expect(vm.$refs.labelMini.$el.children[0].classList.contains('el-form-item--mini')).to.be.true;
});
it('show message', done => { it('show message', done => {
vm = createVue({ vm = createVue({
template: ` template: `