mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-20 11:20:35 +03:00
fix: shortcus with range (#400)
This commit is contained in:
@@ -212,6 +212,19 @@ describe('DatePicker', () => {
|
|||||||
btn.trigger('click');
|
btn.trigger('click');
|
||||||
const emitted = wrapper.emitted();
|
const emitted = wrapper.emitted();
|
||||||
expect(emitted.input).toEqual([['2019/05/10']]);
|
expect(emitted.input).toEqual([['2019/05/10']]);
|
||||||
|
wrapper.setProps({
|
||||||
|
range: true,
|
||||||
|
shortcuts: [
|
||||||
|
{
|
||||||
|
text: 'range',
|
||||||
|
onClick() {
|
||||||
|
return [date, date];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
btn.trigger('click');
|
||||||
|
expect(emitted.input[1]).toEqual([['2019/05/10', '2019/05/10']]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('prop: popupClass', () => {
|
it('prop: popupClass', () => {
|
||||||
|
|||||||
+1
-1
@@ -379,7 +379,7 @@ export default {
|
|||||||
handleSelectShortcut(item) {
|
handleSelectShortcut(item) {
|
||||||
if (isObject(item) && typeof item.onClick === 'function') {
|
if (isObject(item) && typeof item.onClick === 'function') {
|
||||||
const date = item.onClick(this);
|
const date = item.onClick(this);
|
||||||
if (date instanceof Date) {
|
if (date) {
|
||||||
this.emitValue(date);
|
this.emitValue(date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user