mirror of
https://github.com/youzan/vant.git
synced 2025-10-16 08:00:34 +00:00
[Improvement] Switch: support custom size (#723)
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
|
@@ -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;
|
||||
});
|
||||
|
Reference in New Issue
Block a user