mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: addtest
This commit is contained in:
parent
f6a86d4d76
commit
126bf99670
@ -26,6 +26,50 @@ describe('Switch', () => {
|
|||||||
expect(vm.el.classList.contains('zan-switch')).to.true;
|
expect(vm.el.classList.contains('zan-switch')).to.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('create loading switch', () => {
|
||||||
|
vm = createVue({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
checked: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'zan-switch': Switch
|
||||||
|
},
|
||||||
|
template: `
|
||||||
|
<zan-switch :loading="true"></zan-switch>
|
||||||
|
`
|
||||||
|
});
|
||||||
|
vm.mount();
|
||||||
|
|
||||||
|
expect(vm.el.classList.contains('zan-switch--loading')).to.true;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('switch click disabled', done => {
|
||||||
|
vm = createVue({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
checked: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
'zan-switch': Switch
|
||||||
|
},
|
||||||
|
template: `
|
||||||
|
<zan-switch :disabled="disabled"></zan-switch>
|
||||||
|
`
|
||||||
|
});
|
||||||
|
vm.mount();
|
||||||
|
expect(vm.el.classList.contains('zan-switch--disabled')).to.true;
|
||||||
|
expect(vm.el.classList.contains('zan-switch--off')).to.true;
|
||||||
|
vm.el.click();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
expect(vm.el.classList.contains('zan-switch--off')).to.true;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('switch click default', done => {
|
it('switch click default', done => {
|
||||||
vm = createVue({
|
vm = createVue({
|
||||||
data() {
|
data() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user