Commit 2880132d authored by nighca's avatar nighca Committed by 杨奕

DatePicker: fix incorrect interaction on range change when defaultTime provided

parent 23a60a0e
......@@ -426,9 +426,8 @@
},
handleChangeRange(val) {
const defaultTime = this.defaultTime || [];
this.minDate = modifyWithGivenTime(val.minDate, defaultTime[0]);
this.maxDate = modifyWithGivenTime(val.maxDate, defaultTime[1]);
this.minDate = val.minDate;
this.maxDate = val.maxDate;
this.rangeState = val.rangeState;
},
......
......@@ -1272,8 +1272,10 @@ describe('DatePicker', () => {
triggerEvent(leftCell, 'click', true);
setTimeout(_ => {
triggerEvent(rightCell, 'mousemove', true);
triggerEvent(rightCell, 'click', true);
setTimeout(_ => {
expect(rightCell.classList.contains('in-range')).to.be.true;
triggerEvent(rightCell, 'click', true);
setTimeout(_ => {
const {
minDate,
......@@ -1289,6 +1291,7 @@ describe('DatePicker', () => {
}, DELAY);
}, DELAY);
}, DELAY);
}, DELAY);
}, DELAY * 2); // `DELAY * 2` to ensure this case passes in travis CI
});
......@@ -1317,8 +1320,10 @@ describe('DatePicker', () => {
triggerEvent(leftCell, 'click', true);
setTimeout(_ => {
triggerEvent(rightCell, 'mousemove', true);
triggerEvent(rightCell, 'click', true);
setTimeout(_ => {
expect(rightCell.classList.contains('in-range')).to.be.true;
triggerEvent(rightCell, 'click', true);
setTimeout(_ => {
const {
minDate,
......@@ -1334,6 +1339,7 @@ describe('DatePicker', () => {
}, DELAY);
}, DELAY);
}, DELAY);
}, DELAY);
}, DELAY * 2); // `DELAY * 2` to ensure this case passes in travis CI
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment