Skip to content

Commit

Permalink
Fix missing loc in date-input test (#615)
Browse files Browse the repository at this point in the history
* Fix missing loc in date-input test

* Remove unnecessary prop

* Bump patch
  • Loading branch information
chawes13 authored Sep 29, 2023
1 parent 3567ea2 commit e55fb18
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@launchpadlab/lp-components",
"version": "9.2.0",
"version": "9.2.1",
"engines": {
"node": "^18.12"
},
Expand Down
21 changes: 20 additions & 1 deletion test/forms/inputs/date-input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ test("DateInput defaults tabbable item to today's date", async () => {
expect(current).toHaveProperty('tabIndex', 0)
})

test('DateInput sets empty input to an empty string', async () => {
test("DateInput sets empty input to an empty string", async () => {
const user = userEvent.setup()
const onChange = jest.fn()
const props = { input: { ...input, onChange, onBlur: noop }, meta: {} }
Expand All @@ -97,4 +97,23 @@ test('DateInput sets empty input to an empty string', async () => {

expect(onChange).toHaveBeenCalledTimes(1)
expect(onChange).toHaveBeenCalledWith('')
})

test("DateInput invokes onBlur when focus changes", async () => {
const user = userEvent.setup()
const onBlur = jest.fn()
const onChange = jest.fn()
const props = { input: { ...input, onChange, onBlur }, meta: {} }

render(<WrappedDateInput {...props} />)

await user.click(screen.getByRole('textbox'))

const option = screen
.getAllByRole('option', { selected: false, hidden: false })
.at(0)
await user.click(option)
await user.tab()

expect(onBlur).toHaveBeenCalledTimes(1)
})

0 comments on commit e55fb18

Please sign in to comment.