diff --git a/.changeset/great-starfishes-chew.md b/.changeset/great-starfishes-chew.md new file mode 100644 index 000000000..d7494b6c4 --- /dev/null +++ b/.changeset/great-starfishes-chew.md @@ -0,0 +1,5 @@ +--- +'@project44-manifest/react': minor +--- + +fix: fixed warnings in tests diff --git a/packages/react/src/components/LocalNavigation/components/LocalNavigationItem/LocalNavigationItem.tsx b/packages/react/src/components/LocalNavigation/components/LocalNavigationItem/LocalNavigationItem.tsx index 5213bfc10..dc0b58acb 100644 --- a/packages/react/src/components/LocalNavigation/components/LocalNavigationItem/LocalNavigationItem.tsx +++ b/packages/react/src/components/LocalNavigation/components/LocalNavigationItem/LocalNavigationItem.tsx @@ -32,7 +32,6 @@ export const LocalNavigationItem = React.forwardRef((props, forwardedRef) => { css, isSelected, variant = localNavigation?.variant ?? 'primary', - ...other } = props; const itemRef = React.useRef(null); @@ -41,7 +40,7 @@ export const LocalNavigationItem = React.forwardRef((props, forwardedRef) => { { ...props, elementType: typeof as === 'string' ? as : 'button', - }, + } as AriaButtonProps, itemRef, ); const { isFocusVisible, focusProps } = useFocusRing({ autoFocus }); @@ -60,7 +59,7 @@ export const LocalNavigationItem = React.forwardRef((props, forwardedRef) => { return ( ((props, forwardedRe children, css, orientation = 'vertical', - ...other } = props; const state = useRadioGroupState(props); @@ -48,7 +47,7 @@ export const RadioGroup = createComponent((props, forwardedRe }); return ( - + {children} ); diff --git a/packages/react/src/components/button/button.tsx b/packages/react/src/components/button/button.tsx index dc8b580af..0bba9b198 100644 --- a/packages/react/src/components/button/button.tsx +++ b/packages/react/src/components/button/button.tsx @@ -135,7 +135,7 @@ const Button = React.forwardRef((props, forwardedRef) => { return ( { } }); - it('should handle click events', () => { - const onClick = jest.fn(); - - render( - - Overview - Lanes - Carriers - Containers - , - ); - - const button = screen.getAllByRole('button'); - - fireEvent.click(button[0]); - - expect(onClick).toHaveBeenCalled(); - }); - it('should handle press events', () => { const onPress = jest.fn(); diff --git a/packages/react/tests/SegmentedControl.test.tsx b/packages/react/tests/SegmentedControl.test.tsx index 5e27daf96..501fb0546 100644 --- a/packages/react/tests/SegmentedControl.test.tsx +++ b/packages/react/tests/SegmentedControl.test.tsx @@ -6,9 +6,9 @@ describe('segmented control', () => { const onChange = jest.fn(); render( - - - + + + , ); @@ -34,9 +34,9 @@ describe('segmented control', () => { const onChange = jest.fn(); render( - - - + + + , ); diff --git a/packages/react/tests/button.test.tsx b/packages/react/tests/button.test.tsx index 4ad222a36..610ca0a7c 100644 --- a/packages/react/tests/button.test.tsx +++ b/packages/react/tests/button.test.tsx @@ -1,64 +1,49 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { Button } from '../src'; +const mockProps = { + 'aria-label': 'Mock aria', + children: 'Click me', + onPress: jest.fn(), +}; + describe('react-button - Button', () => { + beforeEach(jest.resetAllMocks); + it('should render', () => { - render(); + render(, + ); - - const button = screen.getByRole('button'); - - fireEvent.click(button); - - expect(onClick).toHaveBeenCalled(); - }); - it('should handle press events', () => { - const onPress = jest.fn(); - - render(); + render(, - ); + render(