9
9
10
10
import type Store from 'react-devtools-shared/src/devtools/store' ;
11
11
12
+ import { getVersionedRenderImplementation } from './utils' ;
13
+
12
14
describe ( 'profiling charts' , ( ) => {
13
15
let React ;
14
16
let Scheduler ;
15
- let legacyRender ;
16
17
let store : Store ;
17
18
let utils ;
18
19
19
20
beforeEach ( ( ) => {
20
21
utils = require ( './utils' ) ;
21
22
utils . beforeEachProfiling ( ) ;
22
23
23
- legacyRender = utils . legacyRender ;
24
-
25
24
store = global . store ;
26
25
store . collapseNodesByDefault = false ;
27
26
store . recordChangeDescriptions = true ;
@@ -30,6 +29,8 @@ describe('profiling charts', () => {
30
29
Scheduler = require ( 'scheduler' ) ;
31
30
} ) ;
32
31
32
+ const { render} = getVersionedRenderImplementation ( ) ;
33
+
33
34
function getFlamegraphChartData ( rootID , commitIndex ) {
34
35
const commitTree = store . profilerStore . profilingCache . getCommitTree ( {
35
36
commitIndex,
@@ -78,11 +79,9 @@ describe('profiling charts', () => {
78
79
return null ;
79
80
} ) ;
80
81
81
- const container = document . createElement ( 'div' ) ;
82
-
83
82
utils . act ( ( ) => store . profilerStore . startProfiling ( ) ) ;
84
83
85
- utils . act ( ( ) => legacyRender ( < Parent /> , container ) ) ;
84
+ utils . act ( ( ) => render ( < Parent /> ) ) ;
86
85
expect ( store ) . toMatchInlineSnapshot ( `
87
86
[root]
88
87
▾ <Parent>
@@ -91,7 +90,7 @@ describe('profiling charts', () => {
91
90
<Child key="third"> [Memo]
92
91
` ) ;
93
92
94
- utils . act ( ( ) => legacyRender ( < Parent /> , container ) ) ;
93
+ utils . act ( ( ) => render ( < Parent /> ) ) ;
95
94
expect ( store ) . toMatchInlineSnapshot ( `
96
95
[root]
97
96
▾ <Parent>
@@ -228,11 +227,9 @@ describe('profiling charts', () => {
228
227
return null ;
229
228
} ) ;
230
229
231
- const container = document . createElement ( 'div' ) ;
232
-
233
230
utils . act ( ( ) => store . profilerStore . startProfiling ( ) ) ;
234
231
235
- utils . act ( ( ) => legacyRender ( < Parent /> , container ) ) ;
232
+ utils . act ( ( ) => render ( < Parent /> ) ) ;
236
233
expect ( store ) . toMatchInlineSnapshot ( `
237
234
[root]
238
235
▾ <Parent>
@@ -241,7 +238,7 @@ describe('profiling charts', () => {
241
238
<Child key="third"> [Memo]
242
239
` ) ;
243
240
244
- utils . act ( ( ) => legacyRender ( < Parent /> , container ) ) ;
241
+ utils . act ( ( ) => render ( < Parent /> ) ) ;
245
242
expect ( store ) . toMatchInlineSnapshot ( `
246
243
[root]
247
244
▾ <Parent>
0 commit comments