[Improvement] Field: add button slot (#772)

This commit is contained in:
neverland
2018-03-25 22:12:24 +08:00
committed by GitHub
parent 199ec0cd85
commit 45859cf0a6
7 changed files with 127 additions and 93 deletions

View File

@@ -19,18 +19,6 @@ describe('Field', () => {
expect(wrapper.hasClass('van-field')).to.be.true;
});
it('create a border field', () => {
wrapper = mount(Field, {
propsData: {
type: 'text',
border: true
}
});
expect(wrapper.hasClass('van-field')).to.be.true;
expect(wrapper.hasClass('van-field--border')).to.be.true;
});
it('create a text field with initialize value', (done) => {
wrapper = mount(Field, {
propsData: {
@@ -69,14 +57,12 @@ describe('Field', () => {
it('create a textarea field', (done) => {
wrapper = mount(Field, {
propsData: {
type: 'textarea',
autosize: true
type: 'textarea'
}
});
setTimeout(() => {
expect(wrapper.hasClass('van-field')).to.be.true;
expect(wrapper.hasClass('van-field--has-textarea')).to.be.true;
expect(wrapper.hasClass('van-field--min-height')).to.be.true;
done();
}, 50);
});
@@ -93,9 +79,6 @@ describe('Field', () => {
wrapper.vm.value = val;
});
expect(wrapper.hasClass('van-field')).to.be.true;
expect(wrapper.hasClass('van-field--autosize')).to.be.true;
const textarea = wrapper.find('.van-field__control')[0];
const textareaElement = textarea.element;
const textAreaDiff = (parseInt(textareaElement.style.paddingBottom, 10) +
@@ -128,9 +111,6 @@ describe('Field', () => {
wrapper.vm.value = val;
});
expect(wrapper.hasClass('van-field')).to.be.true;
expect(wrapper.hasClass('van-field--autosize')).to.be.true;
const textarea = wrapper.find('.van-field__control')[0];
const textareaElement = textarea.element;