@@ -39,10 +39,10 @@ describe('pure', () => {
39
39
// a lazy function component.
40
40
sharedTests ( 'normal' , ( ...args ) => {
41
41
const Pure = React . pure ( ...args ) ;
42
- function Indirection ( props , ref ) {
43
- return < Pure { ...props } ref = { ref } /> ;
42
+ function Indirection ( props ) {
43
+ return < Pure { ...props } /> ;
44
44
}
45
- return Promise . resolve ( React . forwardRef ( Indirection ) ) ;
45
+ return Promise . resolve ( Indirection ) ;
46
46
} ) ;
47
47
sharedTests ( 'lazy' , ( ...args ) => Promise . resolve ( React . pure ( ...args ) ) ) ;
48
48
@@ -195,65 +195,6 @@ describe('pure', () => {
195
195
{ withoutStack : true } ,
196
196
) ;
197
197
} ) ;
198
-
199
- it ( 'forwards ref' , async ( ) => {
200
- const { unstable_Suspense : Suspense } = React ;
201
- const Transparent = pure ( ( props , ref ) => {
202
- return < div ref = { ref } /> ;
203
- } ) ;
204
- const divRef = React . createRef ( ) ;
205
-
206
- ReactNoop . render (
207
- < Suspense fallback = { < Text text = "Loading..." /> } >
208
- < Transparent ref = { divRef } />
209
- </ Suspense > ,
210
- ) ;
211
- ReactNoop . flush ( ) ;
212
- await Promise . resolve ( ) ;
213
- ReactNoop . flush ( ) ;
214
- expect ( divRef . current . type ) . toBe ( 'div' ) ;
215
- } ) ;
216
-
217
- it ( 'updates if only ref changes' , async ( ) => {
218
- const { unstable_Suspense : Suspense } = React ;
219
- const Transparent = pure ( ( props , ref ) => {
220
- return [ < Text key = "text" text = "Text" /> , < div key = "div" ref = { ref } /> ] ;
221
- } ) ;
222
-
223
- const divRef = React . createRef ( ) ;
224
- const divRef2 = React . createRef ( ) ;
225
-
226
- ReactNoop . render (
227
- < Suspense fallback = { < Text text = "Loading..." /> } >
228
- < Transparent ref = { divRef } />
229
- </ Suspense > ,
230
- ) ;
231
- expect ( ReactNoop . flush ( ) ) . toEqual ( [ 'Loading...' ] ) ;
232
- await Promise . resolve ( ) ;
233
- expect ( ReactNoop . flush ( ) ) . toEqual ( [ 'Text' ] ) ;
234
- expect ( divRef . current . type ) . toBe ( 'div' ) ;
235
- expect ( divRef2 . current ) . toBe ( null ) ;
236
-
237
- // Should re-render (new ref)
238
- ReactNoop . render (
239
- < Suspense >
240
- < Transparent ref = { divRef2 } />
241
- </ Suspense > ,
242
- ) ;
243
- expect ( ReactNoop . flush ( ) ) . toEqual ( [ 'Text' ] ) ;
244
- expect ( divRef . current ) . toBe ( null ) ;
245
- expect ( divRef2 . current . type ) . toBe ( 'div' ) ;
246
-
247
- // Should not re-render (same ref)
248
- ReactNoop . render (
249
- < Suspense >
250
- < Transparent ref = { divRef2 } />
251
- </ Suspense > ,
252
- ) ;
253
- expect ( ReactNoop . flush ( ) ) . toEqual ( [ ] ) ;
254
- expect ( divRef . current ) . toBe ( null ) ;
255
- expect ( divRef2 . current . type ) . toBe ( 'div' ) ;
256
- } ) ;
257
198
} ) ;
258
199
}
259
200
} ) ;
0 commit comments