From b38724bce7dfc2f143bd4df107f0e6f715151fab Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Wed, 14 Feb 2024 19:52:53 +0100 Subject: [PATCH] Test that we don't call ref --- .../src/__tests__/ReactFunctionComponent-test.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js b/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js index e1692ddcd1904..069c2e001d730 100644 --- a/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactFunctionComponent-test.js @@ -239,21 +239,17 @@ describe('ReactFunctionComponent', () => { }); }); - it('should warn when given a function ref', async () => { + it('should warn when given a function ref and ignore them', async () => { function Indirection(props) { return
{props.children}
; } + const ref = jest.fn(); class ParentUsingFunctionRef extends React.Component { render() { return ( - { - expect(arg).toBe(null); - }} - /> + ); } @@ -276,6 +272,7 @@ describe('ReactFunctionComponent', () => { ' in Indirection (at **)\n' + ' in ParentUsingFunctionRef (at **)', ); + expect(ref).not.toHaveBeenCalled(); const container = document.createElement('div'); const root = ReactDOMClient.createRoot(container);