From d820f964188e48b71eeae09bf7408a1d6a6c436d Mon Sep 17 00:00:00 2001 From: GCHHCG <3124485281@qq.com> Date: Fri, 6 Sep 2024 17:00:02 +0800 Subject: [PATCH] feat(DatePicker2): pressing enter should correctly display the formatted value --- components/date-picker2/__tests__/index-spec.js | 7 +++++++ components/date-picker2/picker.jsx | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/date-picker2/__tests__/index-spec.js b/components/date-picker2/__tests__/index-spec.js index d2d7764938..4b1ba930c5 100644 --- a/components/date-picker2/__tests__/index-spec.js +++ b/components/date-picker2/__tests__/index-spec.js @@ -528,6 +528,13 @@ describe('Picker', () => { wrapper.unmount(); }); + it('pressing enter should correctly display the formatted value', () => { + wrapper = mount( v.format('DD/MM/YYYY')}/>); + changeInput('2020/02/12'); + findInput().simulate('keydown', { keyCode: KEYCODE.ENTER }); + assert(getStrValue(wrapper) === dayjs('2020/02/12').format('DD/MM/YYYY')); + }) + it('outputFormat', () => { wrapper = mount(