fix datetimepicker test

This commit is contained in:
baiyaaaaa 2016-12-01 17:29:52 +08:00
parent 932d6bdb6f
commit 98dda297c9
2 changed files with 4 additions and 6 deletions

View File

@ -53,7 +53,7 @@
}, },
value1: '', value1: '',
value2: '', value2: '',
value3: new Date(), value3: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
value4: '', value4: '',
value5: '', value5: '',
value6: '', value6: '',

View File

@ -470,7 +470,7 @@ describe('DatePicker', () => {
const minMonth = minDate.getMonth(); const minMonth = minDate.getMonth();
const maxMonth = maxDate.getMonth(); const maxMonth = maxDate.getMonth();
expect(maxMonth - minMonth).to.equal(1); // one month expect([1, -11]).to.include(maxMonth - minMonth); // one month
done(); done();
}, DELAY); }, DELAY);
}, DELAY); }, DELAY);
@ -483,7 +483,6 @@ describe('DatePicker', () => {
const right = vm.picker.$el.querySelector('.is-right .el-date-range-picker__header'); const right = vm.picker.$el.querySelector('.is-right .el-date-range-picker__header');
const leftText = left.textContent.match(/\d+/g); const leftText = left.textContent.match(/\d+/g);
const rightText = right.textContent.match(/\d+/g); const rightText = right.textContent.match(/\d+/g);
let count = 20; let count = 20;
while (--count) { while (--count) {
leftBtn.click(); leftBtn.click();
@ -496,11 +495,10 @@ describe('DatePicker', () => {
setTimeout(_ => { setTimeout(_ => {
const newLeft = left.textContent.match(/\d+/g); const newLeft = left.textContent.match(/\d+/g);
const newRight = right.textContent.match(/\d+/g); const newRight = right.textContent.match(/\d+/g);
expect(leftText[1] - newLeft[1]).to.equal(2); expect(leftText[1] - newLeft[1]).to.equal(2);
expect(leftText[0] - newLeft[0]).to.equal(0); expect(leftText[0] - newLeft[0]).to.equal(0);
expect(rightText[1] - newRight[1]).to.equal(2); expect([-10, 2]).to.include(rightText[1] - newRight[1]);
expect(rightText[0] - newRight[0]).to.equal(0); expect([0, 1]).to.include(rightText[0] - newRight[0]);
done(); done();
}, DELAY); }, DELAY);
}); });