手机端样式细节调整,补充测试用例 (#3)

* unit test

* picker and dialog unit tes

* fix:quantity and loading
This commit is contained in:
张敏
2017-04-21 21:25:40 +08:00
committed by GitHub
parent 54f0cf7195
commit c71cb3f2fd
16 changed files with 268 additions and 18 deletions

View File

@@ -77,15 +77,36 @@ describe('Checkbox', () => {
it('create a checkbox', () => {
wrapper = mount(Checkbox, {
propsData: {
value: false,
value: true,
disabled: false
}
});
expect(wrapper.hasClass('van-checkbox')).to.be.true;
expect(wrapper.instance().currentValue).to.be.false;
expect(wrapper.instance().isDisabled).to.be.false;
expect(wrapper.instance().isChecked).to.be.false;
expect(wrapper.vm.currentValue).to.be.true;
expect(wrapper.vm.isDisabled).to.be.false;
expect(wrapper.vm.isChecked).to.be.true;
});
it('create a not boolean value checkbox', (done) => {
wrapper = mount(Checkbox, {
propsData: {
value: 'test',
name: 'test'
}
});
expect(wrapper.hasClass('van-checkbox')).to.be.true;
expect(wrapper.vm.currentValue).to.equal('test');
expect(wrapper.vm.isDisabled).to.be.false;
expect(wrapper.vm.isChecked).to.be.true;
wrapper.vm.value = null;
wrapper.update();
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.currentValue).to.equal(null);
done();
});
});
it('click on a checkbox', (done) => {
@@ -120,12 +141,12 @@ describe('Checkbox', () => {
expect(wrapper.hasClass('van-checkbox')).to.be.true;
expect(wrapper.hasClass('van-checkbox--disabled')).to.be.true;
expect(wrapper.instance().currentValue).to.be.false;
expect(wrapper.instance().isDisabled).to.be.true;
expect(wrapper.vm.currentValue).to.be.false;
expect(wrapper.vm.isDisabled).to.be.true;
const checkboxLabel = wrapper.find('.van-checkbox__label')[0];
checkboxLabel.simulate('click');
expect(wrapper.instance().currentValue).to.be.false;
expect(wrapper.vm.currentValue).to.be.false;
});
});