From 6494b013b230979d8e8dab5cba0b898d4f2e9a6e Mon Sep 17 00:00:00 2001 From: -l Date: Wed, 8 Nov 2023 10:32:12 +0100 Subject: [PATCH] chore: adds on_change test when selecting selected item --- .../drawer-list/__tests__/DrawerList.test.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx index 84ee4dd1a18..8d7a0bb7d44 100644 --- a/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx +++ b/packages/dnb-eufemia/src/fragments/drawer-list/__tests__/DrawerList.test.tsx @@ -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( + + ) + + // 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'