Skip to content

Commit

Permalink
MMT-3960: Add input test
Browse files Browse the repository at this point in the history
  • Loading branch information
htranho committed Jan 2, 2025
1 parent 7cabf42 commit b76c05c
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,24 @@ describe('CustomDateTimeWidget', () => {
describe('When a date has a specific time in the form', () => {
test('shows the date and time', async () => {
setup({
value: '2023-12-05T16:05:59.000Z'
value: '2023-12-05T16:05:59.090Z'
})

const field = await screen.findByPlaceholderText('YYYY-MM-DDTHH:MM:SS.SSSZ')

expect(field).toHaveValue('2023-12-05T16:05:59.000Z')
expect(field).toHaveValue('2023-12-05T16:05:59.090Z')
})
})

describe('when the field is typed in', () => {
test('calls onChange', async () => {
const { props, user } = setup()

const field = await screen.findByPlaceholderText('YYYY-MM-DDTHH:MM:SS.SSSZ')

await user.type(field, '2025-01-02T03:20:15.999Z')

expect(props.onChange).toHaveBeenCalledWith('2025-01-02T03:20:15.999Z')
})
})
})

0 comments on commit b76c05c

Please sign in to comment.