diff --git a/components/date-picker2/__tests__/index-spec.js b/components/date-picker2/__tests__/index-spec.js index c54cc48942..bdf2479352 100644 --- a/components/date-picker2/__tests__/index-spec.js +++ b/components/date-picker2/__tests__/index-spec.js @@ -529,14 +529,27 @@ describe('Picker', () => { }); it('pressing enter should correctly display the formatted value', () => { - wrapper = mount( - - ); + 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) === dayjs('2020/02/12').format('DD/MM/YYYY')); + assert(getStrValue(wrapper) === '12/02/2020'); }); it('outputFormat', () => {