Skip to content

Commit 8657d49

Browse files
committed
fix: panel doesn't close after picking time (#378)
1 parent bf949af commit 8657d49

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

__test__/date-picker.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,22 @@ describe('DatePicker', () => {
300300
const emitted = wrapper.emitted();
301301
expect(emitted.input[0][0]).toEqual([null, null]);
302302
});
303+
304+
it('feat: should close popup when click time in datetime mode', () => {
305+
wrapper = mount(DatePicker, {
306+
propsData: {
307+
type: 'datetime',
308+
timePickerOptions: {
309+
start: '00:00',
310+
step: '00:30',
311+
end: '23:30',
312+
},
313+
open: true,
314+
showTimePanel: true,
315+
},
316+
});
317+
const el = wrapper.find('.mx-time-option');
318+
el.trigger('click');
319+
expect(wrapper.emitted().close).toBeTruthy();
320+
});
303321
});

src/date-picker.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ export default {
343343
return value;
344344
},
345345
afterEmitValue(type) {
346-
if (!type || type === this.type) {
346+
// this.type === 'datetime', click the time should close popup
347+
if (!type || type === this.type || type === 'time') {
347348
this.closePopup();
348349
}
349350
},

0 commit comments

Comments
 (0)