Skip to content

Commit 5f87748

Browse files
committed
up
1 parent 18fb369 commit 5f87748

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/ref.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ describe('ref', () => {
103103
</Holder>,
104104
);
105105
expect(supportRef(FC)).toBeFalsy();
106-
// expect(supportRef(holderRef.current.props.children)).toBeFalsy();
107106
});
108107

109108
it('arrow function component', () => {
@@ -117,7 +116,7 @@ describe('ref', () => {
117116
</Holder>,
118117
);
119118
expect(supportRef(FC)).toBeFalsy();
120-
expect(supportRef(holderRef.current.props.children)).toBeFalsy();
119+
expect(supportRef(holderRef.current.props.children)).toBeTruthy(); // React19 ref 收拢到了 props 里面,默认支持
121120
});
122121

123122
it('forwardRef function component', () => {
@@ -163,7 +162,7 @@ describe('ref', () => {
163162
</Holder>,
164163
);
165164
expect(supportRef(MemoFC)).toBeFalsy();
166-
expect(supportRef(holderRef.current.props.children)).toBeFalsy();
165+
expect(supportRef(holderRef.current.props.children)).toBeTruthy(); // React19 ref 收拢到了 props 里面,默认支持
167166
});
168167

169168
it('memo of forwardRef function component', () => {
@@ -196,7 +195,7 @@ describe('ref', () => {
196195
it('FC', () => {
197196
const FC = () => <div />;
198197
const RefFC = React.forwardRef(FC);
199-
expect(supportNodeRef(<FC />)).toBeFalsy();
198+
expect(supportNodeRef(<FC />)).toBeTruthy(); // React19 ref 收拢到了 props 里面,默认支持
200199
expect(supportNodeRef(<RefFC />)).toBeTruthy();
201200
});
202201

0 commit comments

Comments
 (0)