mirror of https://github.com/ElemeFE/element
DatePicker: fix incorrect interaction on range change when defaultTime provided
parent
23a60a0ef6
commit
2880132de8
|
@ -426,9 +426,8 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
handleChangeRange(val) {
|
handleChangeRange(val) {
|
||||||
const defaultTime = this.defaultTime || [];
|
this.minDate = val.minDate;
|
||||||
this.minDate = modifyWithGivenTime(val.minDate, defaultTime[0]);
|
this.maxDate = val.maxDate;
|
||||||
this.maxDate = modifyWithGivenTime(val.maxDate, defaultTime[1]);
|
|
||||||
this.rangeState = val.rangeState;
|
this.rangeState = val.rangeState;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1272,8 +1272,10 @@ describe('DatePicker', () => {
|
||||||
triggerEvent(leftCell, 'click', true);
|
triggerEvent(leftCell, 'click', true);
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
triggerEvent(rightCell, 'mousemove', true);
|
triggerEvent(rightCell, 'mousemove', true);
|
||||||
triggerEvent(rightCell, 'click', true);
|
setTimeout(_ => {
|
||||||
|
expect(rightCell.classList.contains('in-range')).to.be.true;
|
||||||
|
|
||||||
|
triggerEvent(rightCell, 'click', true);
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
const {
|
const {
|
||||||
minDate,
|
minDate,
|
||||||
|
@ -1289,6 +1291,7 @@ describe('DatePicker', () => {
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
|
}, DELAY);
|
||||||
}, DELAY * 2); // `DELAY * 2` to ensure this case passes in travis CI
|
}, DELAY * 2); // `DELAY * 2` to ensure this case passes in travis CI
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1317,8 +1320,10 @@ describe('DatePicker', () => {
|
||||||
triggerEvent(leftCell, 'click', true);
|
triggerEvent(leftCell, 'click', true);
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
triggerEvent(rightCell, 'mousemove', true);
|
triggerEvent(rightCell, 'mousemove', true);
|
||||||
triggerEvent(rightCell, 'click', true);
|
setTimeout(_ => {
|
||||||
|
expect(rightCell.classList.contains('in-range')).to.be.true;
|
||||||
|
|
||||||
|
triggerEvent(rightCell, 'click', true);
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
const {
|
const {
|
||||||
minDate,
|
minDate,
|
||||||
|
@ -1334,6 +1339,7 @@ describe('DatePicker', () => {
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
|
}, DELAY);
|
||||||
}, DELAY * 2); // `DELAY * 2` to ensure this case passes in travis CI
|
}, DELAY * 2); // `DELAY * 2` to ensure this case passes in travis CI
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue