From 65d6ea293b223299c94155fa6ec210e6b706d048 Mon Sep 17 00:00:00 2001 From: anastasialanz Date: Wed, 2 Oct 2024 13:05:44 -0500 Subject: [PATCH] test: add required onSelect prop to OptionsMenu test --- .../OptionsMenu/OptionsMenu.test.tsx | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/packages/react/src/components/OptionsMenu/OptionsMenu.test.tsx b/packages/react/src/components/OptionsMenu/OptionsMenu.test.tsx index 9e28b2e60..5f100b004 100644 --- a/packages/react/src/components/OptionsMenu/OptionsMenu.test.tsx +++ b/packages/react/src/components/OptionsMenu/OptionsMenu.test.tsx @@ -11,8 +11,10 @@ const trigger = (props: React.HTMLAttributes) => ( ); test('should render menu', () => { + const onSelect = jest.fn(); + render( - +
  • option 1
  • option 2
  • @@ -23,8 +25,10 @@ test('should render menu', () => { }); test('should render children', () => { + const onSelect = jest.fn(); + render( - +
  • option 1
  • option 2
  • @@ -34,8 +38,10 @@ test('should render children', () => { }); test('should render trigger prop', () => { + const onSelect = jest.fn(); + render( - +
  • option 1
  • ); @@ -44,8 +50,10 @@ test('should render trigger prop', () => { }); test('should support className prop', () => { + const onSelect = jest.fn(); + render( - +
  • option 1
  • option 2
  • @@ -57,13 +65,15 @@ test('should support className prop', () => { }); test('should support align prop', () => { + const onSelect = jest.fn(); + render( <> - +
  • option 1
  • option 2
  • - +
  • option 1
  • option 2
  • @@ -80,8 +90,10 @@ test('should support align prop', () => { test('should support menuRef prop', () => { const menuRef = React.createRef(); + const onSelect = jest.fn(); + render( - +
  • option 1
  • option 2
  • @@ -93,8 +105,10 @@ test('should support menuRef prop', () => { test('should toggle menu on trigger clicks', async () => { const user = userEvent.setup(); + const onSelect = jest.fn(); + render( - +
  • option 1
  • ); @@ -112,8 +126,10 @@ test('should toggle menu on trigger clicks', async () => { }); test('should click trigger with down key on trigger', () => { + const onSelect = jest.fn(); + render( - +
  • option 1
  • ); @@ -126,9 +142,10 @@ test('should click trigger with down key on trigger', () => { test('should focus trigger on close', async () => { const user = userEvent.setup(); + const onSelect = jest.fn(); render( - +
  • option 1
  • ); @@ -143,9 +160,10 @@ test('should focus trigger on close', async () => { test('should call onClose when closed', async () => { const user = userEvent.setup(); const onClose = jest.fn(); + const onSelect = jest.fn(); render( - +
  • option 1
  • ); @@ -159,11 +177,12 @@ test('should call onClose when closed', async () => { test('should close menu when click outside event occurs', async () => { const user = userEvent.setup(); + const onSelect = jest.fn(); render( <> - +
  • option 1
  • @@ -176,8 +195,9 @@ test('should close menu when click outside event occurs', async () => { }); test('should return no axe violations when hidden', async () => { + const onSelect = jest.fn(); const { container } = render( - +
  • option 1
  • ); @@ -186,8 +206,9 @@ test('should return no axe violations when hidden', async () => { }); test('should return no axe violations when shown', async () => { + const onSelect = jest.fn(); const { container } = render( - +
  • option 1
  • );