8
8
*/
9
9
10
10
const { printOwnersList} = require ( '../devtools/utils' ) ;
11
+ const { getVersionedRenderImplementation} = require ( './utils' ) ;
11
12
12
13
describe ( 'Store owners list' , ( ) => {
13
14
let React ;
14
15
let act ;
15
- let legacyRender ;
16
16
let store ;
17
17
18
18
beforeEach ( ( ) => {
@@ -23,9 +23,10 @@ describe('Store owners list', () => {
23
23
24
24
const utils = require ( './utils' ) ;
25
25
act = utils . act ;
26
- legacyRender = utils . legacyRender ;
27
26
} ) ;
28
27
28
+ const { render} = getVersionedRenderImplementation ( ) ;
29
+
29
30
function getFormattedOwnersList ( elementID ) {
30
31
const ownersList = store . getOwnersListForElement ( elementID ) ;
31
32
return printOwnersList ( ownersList ) ;
@@ -43,7 +44,7 @@ describe('Store owners list', () => {
43
44
const Leaf = ( ) => < div > Leaf</ div > ;
44
45
const Intermediate = ( { children} ) => < Wrapper > { children } </ Wrapper > ;
45
46
46
- act ( ( ) => legacyRender ( < Root /> , document . createElement ( 'div' ) ) ) ;
47
+ act ( ( ) => render ( < Root /> ) ) ;
47
48
expect ( store ) . toMatchInlineSnapshot ( `
48
49
[root]
49
50
▾ <Root>
@@ -80,7 +81,7 @@ describe('Store owners list', () => {
80
81
< Wrapper key = "wrapper" > { children } </ Wrapper > ,
81
82
] ;
82
83
83
- act ( ( ) => legacyRender ( < Root /> , document . createElement ( 'div' ) ) ) ;
84
+ act ( ( ) => render ( < Root /> ) ) ;
84
85
expect ( store ) . toMatchInlineSnapshot ( `
85
86
[root]
86
87
▾ <Root>
@@ -122,14 +123,7 @@ describe('Store owners list', () => {
122
123
const Leaf = ( ) => < div > Leaf</ div > ;
123
124
const Intermediate = ( { children} ) => < Wrapper > { children } </ Wrapper > ;
124
125
125
- const container = document . createElement ( 'div' ) ;
126
-
127
- act ( ( ) =>
128
- legacyRender (
129
- < Root includeDirect = { false } includeIndirect = { true } /> ,
130
- container ,
131
- ) ,
132
- ) ;
126
+ act ( ( ) => render ( < Root includeDirect = { false } includeIndirect = { true } /> ) ) ;
133
127
134
128
const rootID = store . getElementIDAtIndex ( 0 ) ;
135
129
expect ( store ) . toMatchInlineSnapshot ( `
@@ -145,12 +139,7 @@ describe('Store owners list', () => {
145
139
<Leaf>"
146
140
` ) ;
147
141
148
- act ( ( ) =>
149
- legacyRender (
150
- < Root includeDirect = { true } includeIndirect = { true } /> ,
151
- container ,
152
- ) ,
153
- ) ;
142
+ act ( ( ) => render ( < Root includeDirect = { true } includeIndirect = { true } /> ) ) ;
154
143
expect ( store ) . toMatchInlineSnapshot ( `
155
144
[root]
156
145
▾ <Root>
@@ -166,12 +155,7 @@ describe('Store owners list', () => {
166
155
<Leaf>"
167
156
` ) ;
168
157
169
- act ( ( ) =>
170
- legacyRender (
171
- < Root includeDirect = { true } includeIndirect = { false } /> ,
172
- container ,
173
- ) ,
174
- ) ;
158
+ act ( ( ) => render ( < Root includeDirect = { true } includeIndirect = { false } /> ) ) ;
175
159
expect ( store ) . toMatchInlineSnapshot ( `
176
160
[root]
177
161
▾ <Root>
@@ -182,12 +166,7 @@ describe('Store owners list', () => {
182
166
<Leaf>"
183
167
` ) ;
184
168
185
- act ( ( ) =>
186
- legacyRender (
187
- < Root includeDirect = { false } includeIndirect = { false } /> ,
188
- container ,
189
- ) ,
190
- ) ;
169
+ act ( ( ) => render ( < Root includeDirect = { false } includeIndirect = { false } /> ) ) ;
191
170
expect ( store ) . toMatchInlineSnapshot ( `
192
171
[root]
193
172
<Root>
@@ -204,8 +183,7 @@ describe('Store owners list', () => {
204
183
: [ < Leaf key = "C" /> , < Leaf key = "B" /> , < Leaf key = "A" /> ] ;
205
184
const Leaf = ( ) => < div > Leaf</ div > ;
206
185
207
- const container = document . createElement ( 'div' ) ;
208
- act ( ( ) => legacyRender ( < Root ascending = { true } /> , container ) ) ;
186
+ act ( ( ) => render ( < Root ascending = { true } /> ) ) ;
209
187
210
188
const rootID = store . getElementIDAtIndex ( 0 ) ;
211
189
expect ( store ) . toMatchInlineSnapshot ( `
@@ -222,7 +200,7 @@ describe('Store owners list', () => {
222
200
<Leaf key="C">"
223
201
` ) ;
224
202
225
- act ( ( ) => legacyRender ( < Root ascending = { false } /> , container ) ) ;
203
+ act ( ( ) => render ( < Root ascending = { false } /> ) ) ;
226
204
expect ( store ) . toMatchInlineSnapshot ( `
227
205
[root]
228
206
▾ <Root>
0 commit comments