Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #212 from kcdraidgroup/aprillion-3
Browse files Browse the repository at this point in the history
fix(test): improve DateTimePickerWithLabelFormGroup
  • Loading branch information
JacobMGEvans authored Jan 3, 2021
2 parents 0cb3562 + 8da5bc4 commit 13b8e41
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<DateTimePickerWithLabelFormGroup
name="stardate55555555"
label="stardate55555555"
value={new Date('1/1/2021 2:56 PM')}
isEditable
onChange={jest.fn()}
/>,
)
const datepickerInput = screen.getByRole('textbox')
describe('change handler', () => {
it('should call the change handler on change', () => {
render(
<DateTimePickerWithLabelFormGroup
name="stardate55555555"
label="stardate55555555"
value={new Date('1/1/2021 2:56 PM')}
isEditable
onChange={jest.fn()}
/>,
)
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)
})
})

0 comments on commit 13b8e41

Please sign in to comment.