Skip to content

Commit 801f85f

Browse files
authored
Update ReactFunctionComponent-test.js
1 parent 9229781 commit 801f85f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/react-dom/src/__tests__/ReactFunctionComponent-test.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ describe('ReactFunctionComponent', () => {
242242
ReactTestUtils.renderIntoDocument(<ParentUsingFunctionRef />);
243243
});
244244

245-
xit('deduplicates ref warnings based on element or owner', () => {
245+
it('deduplicates ref warnings based on element or owner', () => {
246246
// When owner uses JSX, we can use exact line location to dedupe warnings
247247
class AnonymousParentUsingJSX extends React.Component {
248248
render() {
@@ -284,10 +284,8 @@ describe('ReactFunctionComponent', () => {
284284
}).toErrorDev('Warning: Function components cannot be given refs.');
285285
// Should be deduped (same internal instance, no additional warnings)
286286
instance2.forceUpdate();
287-
// Could not be deduped (different internal instance):
288-
expect(() =>
289-
ReactTestUtils.renderIntoDocument(<AnonymousParentNotUsingJSX />),
290-
).toErrorDev('Warning: Function components cannot be given refs.');
287+
// Could not be differentiated (since owner is anonymous and no source location)
288+
ReactTestUtils.renderIntoDocument(<AnonymousParentNotUsingJSX />);
291289

292290
// When owner doesn't use JSX, but is named, we warn once per owner name
293291
class NamedParentNotUsingJSX extends React.Component {

0 commit comments

Comments
 (0)