fix: AddressEdit test cases failed

This commit is contained in:
陈嘉涵 2017-09-27 10:24:46 +08:00
parent 3728c9b47d
commit 6dd0f18df2
4 changed files with 6 additions and 12 deletions

View File

@ -4,15 +4,9 @@ import areaList from '../mock/area.json';
export default {
data() {
setTimeout(() => {
this.test.user_name = 'b';
}, 1000);
return {
areaList,
searchResult: [],
test: {
user_name: 'a'
}
searchResult: []
}
},
@ -61,7 +55,6 @@ Vue.component(AddressEdit.name, AddressEdit);
:::demo 基础用法
```html
<van-address-edit
:address-info="test"
:area-list="areaList"
:show-postal="true"
:show-set-default="true"

View File

@ -242,7 +242,6 @@ describe('AddressEdit', () => {
done();
});
document.querySelector('.van-dialog__confirm').click();
done();
}, 300);
});
}, 300);

View File

@ -14,10 +14,9 @@ describe('Dialog', () => {
done();
});
expect(document.querySelector('.van-dialog')).to.exist;
expect(document.querySelector('.van-dialog__cancel').style.display).to.equal('none');
setTimeout(() => {
expect(document.querySelector('.van-dialog')).to.exist;
expect(document.querySelector('.van-dialog__cancel').style.display).to.equal('none');
document.querySelector('.van-dialog__confirm').click();
}, 500);
});

View File

@ -136,12 +136,15 @@ describe('Field', () => {
it('blur event', (done) => {
const blur = sinon.spy();
const focus = sinon.spy();
const clickIcon = sinon.spy();
wrapper = mount(FieldWithIcon, {});
wrapper.vm.$on('blur', blur);
wrapper.vm.$on('focus', focus);
wrapper.find('.van-field__icon')[0].trigger('click');
wrapper.find('.van-field__control')[0].trigger('focus');
wrapper.find('.van-field__control')[0].trigger('blur');
expect(blur.calledOnce).to.be.true;