diff --git a/src/hooks/useSelect/__tests__/getLabelProps.test.js b/src/hooks/useSelect/__tests__/getLabelProps.test.js index 84877803..c6f5ab3d 100644 --- a/src/hooks/useSelect/__tests__/getLabelProps.test.js +++ b/src/hooks/useSelect/__tests__/getLabelProps.test.js @@ -1,4 +1,4 @@ -import {act, screen} from '@testing-library/react' +import {screen} from '@testing-library/react' import {renderSelect, renderUseSelect} from '../testUtils' import {defaultIds, getToggleButton, user} from '../../testUtils' @@ -53,15 +53,13 @@ describe('getLabelProps', () => { const mockToggleButton = {focus: jest.fn()} const {result} = renderUseSelect() - act(() => { - const {onClick} = result.current.getLabelProps({ - onClick: userOnClick, - }) - const {ref} = result.current.getToggleButtonProps() - ref(mockToggleButton) - - onClick({}) + const {onClick} = result.current.getLabelProps({ + onClick: userOnClick, }) + const {ref} = result.current.getToggleButtonProps() + ref(mockToggleButton) + + onClick({}) expect(userOnClick).toHaveBeenCalledTimes(1) expect(mockToggleButton.focus).toHaveBeenCalledTimes(1) @@ -74,15 +72,13 @@ describe('getLabelProps', () => { const mockToggleButton = {focus: jest.fn()} const {result} = renderUseSelect() - act(() => { - const {onClick} = result.current.getLabelProps({ - onClick: userOnClick, - }) - const {ref} = result.current.getToggleButtonProps() - ref(mockToggleButton) - - onClick({}) + const {onClick} = result.current.getLabelProps({ + onClick: userOnClick, }) + const {ref} = result.current.getToggleButtonProps() + ref(mockToggleButton) + + onClick({}) expect(userOnClick).toHaveBeenCalledTimes(1) expect(mockToggleButton.focus).not.toHaveBeenCalled() diff --git a/typings/index.d.ts b/typings/index.d.ts index b090d232..9836617e 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -419,11 +419,11 @@ export interface UseSelectGetToggleButtonReturnValue tabIndex: 0 } -export interface UseSelectGetLabelPropsOptions extends GetLabelPropsOptions { +export interface UseSelectGetLabelPropsOptions extends GetLabelPropsOptions {} +export interface UseSelectGetLabelPropsReturnValue + extends GetLabelPropsReturnValue { onClick: React.MouseEventHandler } -export interface UseSelectGetLabelPropsReturnValue - extends GetLabelPropsReturnValue {} export interface UseSelectGetItemPropsOptions extends Omit, 'disabled'>,