2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-05-28 17:14:07 +03:00

fix: shortcus with range (#400)

This commit is contained in:
xiemx
2019-12-17 10:05:53 +08:00
parent b33c9b8f19
commit bb0255f188
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -212,6 +212,19 @@ describe('DatePicker', () => {
btn.trigger('click');
const emitted = wrapper.emitted();
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', () => {
+1 -1
View File
@@ -379,7 +379,7 @@ export default {
handleSelectShortcut(item) {
if (isObject(item) && typeof item.onClick === 'function') {
const date = item.onClick(this);
if (date instanceof Date) {
if (date) {
this.emitValue(date);
}
}