Skip to content

Commit

Permalink
chore: add on_change test when for selecting selected item (#2864)
Browse files Browse the repository at this point in the history
  • Loading branch information
langz authored Nov 8, 2023
2 parents d229ec2 + 6494b01 commit 0a5127f
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 0a5127f

Please sign in to comment.