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 #213 from kcdraidgroup/aprillion-4
Browse files Browse the repository at this point in the history
fix(test): improve DatePickerWithLabelFormGroup
  • Loading branch information
mpeyper authored Jan 3, 2021
2 parents 7a162f2 + f056391 commit b055637
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,28 @@ describe('date picker with label form group', () => {
)
expect(screen.getByRole('textbox')).toBeDisabled()
})
describe('change handler', () => {
it('should call the change handler on change', () => {
render(
})

describe('change handler', () => {
it('should call the change handler on change', () => {
const TestComponent = () => {
const [value, setValue] = React.useState(new Date('01/01/2019'))
return (
<DatePickerWithLabelFormGroup
name="stardate3333"
label="stardate3333"
value={new Date('01/01/2019')}
value={value}
isEditable
onChange={jest.fn()}
/>,
onChange={setValue}
/>
)
const datepickerInput = screen.getByRole('textbox')
}
render(<TestComponent />)
const datepickerInput = screen.getByRole('textbox')

expect(datepickerInput).toHaveDisplayValue(['01/01/2019'])
userEvent.type(datepickerInput, '{selectall}12/25/2021')
expect(datepickerInput).toHaveDisplayValue(['12/25/2021'])
})
expect(datepickerInput).toHaveDisplayValue(['01/01/2019'])
userEvent.type(datepickerInput, '{selectall}12/25/2021{enter}')
expect(datepickerInput).toHaveDisplayValue(['12/25/2021'])
})
})
})

0 comments on commit b055637

Please sign in to comment.