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 3a0d727
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()

const { rerender } = render(

Check failure on line 345 in packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx

View workflow job for this annotation

GitHub Actions / Run tests and checks

'rerender' is assigned a value but never used

Check failure on line 345 in packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx

View workflow job for this annotation

GitHub Actions / Run tests and checks

'rerender' is assigned a value but never used
<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 3a0d727

Please sign in to comment.