Skip to content

Commit

Permalink
chore: adds on_change test when selecting selected item
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Nov 8, 2023
1 parent 1cd6be4 commit 6494b01
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,28 @@ describe('DrawerList component', () => {
})
})

it('does not fire on_change when selecting the selected item', async () => {
const on_change = jest.fn()

render(
<DrawerList
{...props}
value={0}
data={mockData}
on_change={on_change}
/>
)

// then simulate changes
keydown(40) // down
keydown(38) // up
keydown(32) // space

await waitFor(() => {
expect(on_change).toBeCalledTimes(0)
})
})

it('has correct direction prop', () => {
const directionTop = 'top'

Expand Down

0 comments on commit 6494b01

Please sign in to comment.