diff --git a/components/date-picker2/__tests__/index-spec.js b/components/date-picker2/__tests__/index-spec.js index bdf2479352..93e5989378 100644 --- a/components/date-picker2/__tests__/index-spec.js +++ b/components/date-picker2/__tests__/index-spec.js @@ -528,30 +528,6 @@ describe('Picker', () => { wrapper.unmount(); }); - it('pressing enter should correctly display the formatted value', () => { - function App() { - const [value, setValue] = useState(''); - return ( - { - setValue(v), - assert( - v === dayjs('12/02/2020', 'DD/MM/YYYY').format('YYYY-MM-DD') - ); - }} - /> - ); - } - wrapper = mount(); - changeInput('12/02/2020'); - findInput().simulate('keydown', { keyCode: KEYCODE.ENTER }); - assert(getStrValue(wrapper) === '12/02/2020'); - }); - it('outputFormat', () => { wrapper = mount( { findInput(0).simulate('keydown', { keyCode: KEYCODE.SPACE }); assert(getStrValue(wrapper).join(',') === '2020-11-11 ,'); }) + + // fix https://github.com/alibaba-fusion/next/issues/4896 + it('After entering a customized date format and pressing Enter, the value should not change', () => { + function App() { + const [value, setValue] = useState(''); + return ( + { + setValue(v), + assert( + v === dayjs('12/02/2020', 'DD/MM/YYYY').format('YYYY-MM-DD') + ); + }} + /> + ); + } + wrapper = mount(); + changeInput('12/02/2020'); + findInput().simulate('keydown', { keyCode: KEYCODE.ENTER }); + assert(getStrValue(wrapper) === '12/02/2020'); + }); }); });