[Improvement] Switch: support custom size (#723)

This commit is contained in:
neverland
2018-03-19 13:44:12 +08:00
committed by GitHub
parent 1489efd9f9
commit c6a3896ce7
9 changed files with 62 additions and 63 deletions

View File

@@ -15,7 +15,7 @@ describe('SwitchCell', () => {
DOMChecker(wrapper, {
count: {
'.van-switch--off': 1,
'.van-switch--on': 0,
'.van-switch--disabled': 0
}
});
@@ -34,7 +34,7 @@ describe('SwitchCell', () => {
'.van-cell__text': '测试标题'
},
count: {
'.van-switch--off': 1,
'.van-switch--on': 0,
'.van-switch--disabled': 0
}
});
@@ -66,7 +66,7 @@ describe('SwitchCell', () => {
DOMChecker(wrapper, {
count: {
'.van-switch--off': 1,
'.van-switch--on': 0,
'.van-switch--disabled': 1
}
});

View File

@@ -20,17 +20,6 @@ describe('Switch', () => {
expect(wrapper.hasClass('van-switch--on')).to.be.true;
});
it('create off switch', () => {
wrapper = mount(Switch, {
propsData: {
value: false
}
});
expect(wrapper.hasClass('van-switch')).to.be.true;
expect(wrapper.hasClass('van-switch--off')).to.be.true;
});
it('create loading switch', () => {
wrapper = mount(Switch, {
propsData: {
@@ -75,9 +64,9 @@ describe('Switch', () => {
}
});
expect(wrapper.hasClass('van-switch--off')).to.be.true;
expect(wrapper.hasClass('van-switch--on')).to.be.false;
wrapper.trigger('click');
expect(wrapper.hasClass('van-switch--off')).to.be.true;
expect(wrapper.hasClass('van-switch--on')).to.be.false;
});
it('click should toggle the switch', () => {
@@ -91,7 +80,7 @@ describe('Switch', () => {
wrapper.vm.value = val;
});
expect(wrapper.hasClass('van-switch--off')).to.be.true;
expect(wrapper.hasClass('van-switch--on')).to.be.false;
wrapper.trigger('click');
expect(wrapper.hasClass('van-switch--on')).to.be.true;
});