Skip to content

Commit e55fb18

Browse files
authored
Fix missing loc in date-input test (#615)
* Fix missing loc in date-input test * Remove unnecessary prop * Bump patch
1 parent 3567ea2 commit e55fb18

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@launchpadlab/lp-components",
3-
"version": "9.2.0",
3+
"version": "9.2.1",
44
"engines": {
55
"node": "^18.12"
66
},

test/forms/inputs/date-input.test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ test("DateInput defaults tabbable item to today's date", async () => {
8686
expect(current).toHaveProperty('tabIndex', 0)
8787
})
8888

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

9898
expect(onChange).toHaveBeenCalledTimes(1)
9999
expect(onChange).toHaveBeenCalledWith('')
100+
})
101+
102+
test("DateInput invokes onBlur when focus changes", async () => {
103+
const user = userEvent.setup()
104+
const onBlur = jest.fn()
105+
const onChange = jest.fn()
106+
const props = { input: { ...input, onChange, onBlur }, meta: {} }
107+
108+
render(<WrappedDateInput {...props} />)
109+
110+
await user.click(screen.getByRole('textbox'))
111+
112+
const option = screen
113+
.getAllByRole('option', { selected: false, hidden: false })
114+
.at(0)
115+
await user.click(option)
116+
await user.tab()
117+
118+
expect(onBlur).toHaveBeenCalledTimes(1)
100119
})

0 commit comments

Comments
 (0)