Skip to content

Commit a978553

Browse files
committed
Adapt test to work with React 18.
1 parent 929920b commit a978553

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

test/components/connect.spec.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,15 +2590,20 @@ describe('React', () => {
25902590
})
25912591

25922592
it('should not override ref property when not asked to.', async () => {
2593+
type RootStateType = {}
25932594
const store = createStore(() => ({}))
2594-
interface RefReceiverProps {
2595-
ref: React.Ref<HTMLSpanElement | null>
2596-
}
2597-
function RefReceiver(props: RefReceiverProps) {
2598-
const {ref} = props
2599-
return <span ref={ref} />
2600-
}
2601-
const DecoratedRefReceiver = connect()(RefReceiver)
2595+
type RefReceiverPropsType = {}
2596+
const RefReceiver = React.forwardRef<HTMLSpanElement, RefReceiverPropsType>(
2597+
(props: RefReceiverPropsType, ref) => <span ref={ref} />
2598+
);
2599+
type RefReceiverNoDispatchType = null
2600+
const decorator = connect<
2601+
RefReceiverPropsType,
2602+
RefReceiverNoDispatchType,
2603+
RefReceiverPropsType,
2604+
RootStateType
2605+
>(null, null)
2606+
const DecoratedRefReceiver = decorator(RefReceiver)
26022607
const testRef = React.createRef<HTMLSpanElement>()
26032608
rtl.render(
26042609
<ProviderMock store={store}>

0 commit comments

Comments
 (0)