diff --git a/test/unit/specs/switch.spec.js b/test/unit/specs/switch.spec.js index 176d69ead..ccb88ef9c 100644 --- a/test/unit/specs/switch.spec.js +++ b/test/unit/specs/switch.spec.js @@ -26,6 +26,50 @@ describe('Switch', () => { expect(vm.el.classList.contains('zan-switch')).to.true; }); + it('create loading switch', () => { + vm = createVue({ + data() { + return { + checked: false + }; + }, + components: { + 'zan-switch': Switch + }, + template: ` + + ` + }); + 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: ` + + ` + }); + 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 => { vm = createVue({ data() {