From d6721eed82c2514a3a690923a57c5ca84f51998f Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Fri, 21 Oct 2016 17:29:53 +0800 Subject: [PATCH] fix some potential test err --- test/unit/specs/alert.spec.js | 7 ++----- test/unit/specs/slider.spec.js | 7 +++---- test/unit/specs/switch.spec.js | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/test/unit/specs/alert.spec.js b/test/unit/specs/alert.spec.js index f6a79fe8311..3355185e398 100644 --- a/test/unit/specs/alert.spec.js +++ b/test/unit/specs/alert.spec.js @@ -29,7 +29,7 @@ describe('Alert', () => { expect(vm.$el.querySelector('.el-alert__description')).to.exist; }); - it('close', done => { + it('close', () => { const vm = createVue({ template: `
@@ -40,9 +40,6 @@ describe('Alert', () => { ` }, true); vm.$el.querySelector('.el-alert__closebtn').click(); - setTimeout(() => { - expect(vm.$children[0].$el.style.display).to.equal('none'); - done(); - }, 300); + expect(vm.$children[0].visible).to.false; }); }); diff --git a/test/unit/specs/slider.spec.js b/test/unit/specs/slider.spec.js index 80c04c7a2c9..4a7677a5b3d 100644 --- a/test/unit/specs/slider.spec.js +++ b/test/unit/specs/slider.spec.js @@ -36,7 +36,7 @@ describe('Slider', () => { }, 100); }); - it('show tooltip', () => { + it('show tooltip', done => { const vm = createVue({ template: `
@@ -57,9 +57,8 @@ describe('Slider', () => { vm.$nextTick(() => { expect(popup.style.display).to.not.equal('none'); slider.onDragEnd(); - setTimeout(() => { - expect(popup.style.display).to.equal('none'); - }, 350); + expect(slider.showTip).to.false; + done(); }); }); diff --git a/test/unit/specs/switch.spec.js b/test/unit/specs/switch.spec.js index dc48546ce5b..b88c9c37c55 100644 --- a/test/unit/specs/switch.spec.js +++ b/test/unit/specs/switch.spec.js @@ -49,7 +49,7 @@ describe('Switch', () => { Vue.nextTick(() => { expect(vm.value).to.equal(false); expect(getComputedStyle(core).backgroundColor).to.equal('rgb(192, 204, 218)'); - expect(button.style.transform).to.equal('translate3d(2px, 2px, 0)'); + expect(/2px, 2px/.test(button.style.transform)).to.true; core.click(); expect(vm.value).to.equal(true); done();