From 8da5bc4ee104d485e32011b59068583b7001502b Mon Sep 17 00:00:00 2001 From: Peter Hozak Date: Sun, 3 Jan 2021 21:34:34 +0100 Subject: [PATCH] fix(test): improve DateTimePickerWithLabelFormGroup * workaround for 'NaN is an invalid value' console.error by pressing {enter} --- .../DateTimePickerWithLabelFormGroup.test.tsx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/__tests__/shared/components/input/DateTimePickerWithLabelFormGroup.test.tsx b/src/__tests__/shared/components/input/DateTimePickerWithLabelFormGroup.test.tsx index c7a4cec63e..7ddace4040 100644 --- a/src/__tests__/shared/components/input/DateTimePickerWithLabelFormGroup.test.tsx +++ b/src/__tests__/shared/components/input/DateTimePickerWithLabelFormGroup.test.tsx @@ -51,23 +51,23 @@ describe('date picker with label form group', () => { expect(datepickerInput).toHaveDisplayValue(/[12/25/2020 2:56 PM]/i) }) }) +}) - describe('change handler', () => { - it('should call the change handler on change', () => { - render( - , - ) - const datepickerInput = screen.getByRole('textbox') +describe('change handler', () => { + it('should call the change handler on change', () => { + render( + , + ) + const datepickerInput = screen.getByRole('textbox') - expect(datepickerInput).toHaveDisplayValue(/[01/01/2021 2:56 PM]/i) - userEvent.type(datepickerInput, '12/25/2020 2:56 PM') - expect(datepickerInput).toHaveDisplayValue(/[12/25/2020 2:56 PM]/i) - }) + expect(datepickerInput).toHaveDisplayValue(/[01/01/2021 2:56 PM]/i) + userEvent.type(datepickerInput, '{selectall}12/25/2020 2:56 PM{enter}') + expect(datepickerInput).toHaveDisplayValue(/[12/25/2020 2:56 PM]/i) }) })