11
11
12
12
import '../../../Core/InitializeCore.js' ;
13
13
14
- import * as ReactNativeTester from '../../../../src/private/__tests__/ReactNativeTester' ;
15
14
import ReactNativeElement from '../../../../src/private/webapis/dom/nodes/ReactNativeElement' ;
16
15
import TextInputState from '../../../Components/TextInput/TextInputState' ;
17
16
import View from '../../../Components/View/View' ;
18
17
import ReactFabricHostComponent from '../ReactFabricHostComponent' ;
18
+ import * as Fantom from '@react-native/fantom' ;
19
19
import nullthrows from 'nullthrows' ;
20
20
import * as React from 'react' ;
21
21
@@ -25,8 +25,8 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
25
25
it ( 'should provide instances of the right class as refs in host components' , ( ) => {
26
26
let node ;
27
27
28
- const root = ReactNativeTester . createRoot ( ) ;
29
- ReactNativeTester . runTask ( ( ) => {
28
+ const root = Fantom . createRoot ( ) ;
29
+ Fantom . runTask ( ( ) => {
30
30
root . render (
31
31
< View
32
32
ref = { receivedNode => {
@@ -43,11 +43,11 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
43
43
44
44
describe ( 'blur' , ( ) => {
45
45
test ( 'blur() invokes TextInputState' , ( ) => {
46
- const root = ReactNativeTester . createRoot ( ) ;
46
+ const root = Fantom . createRoot ( ) ;
47
47
48
48
let maybeNode ;
49
49
50
- ReactNativeTester . runTask ( ( ) => {
50
+ Fantom . runTask ( ( ) => {
51
51
root . render (
52
52
< View
53
53
ref = { node => {
@@ -64,7 +64,7 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
64
64
// We don't support view commands in Fantom yet, so we have to mock this.
65
65
TextInputState . blurTextInput = blurTextInput ;
66
66
67
- ReactNativeTester . runTask ( ( ) => {
67
+ Fantom . runTask ( ( ) => {
68
68
node . blur ( ) ;
69
69
} ) ;
70
70
@@ -75,11 +75,11 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
75
75
76
76
describe ( 'focus' , ( ) => {
77
77
test ( 'focus() invokes TextInputState' , ( ) => {
78
- const root = ReactNativeTester . createRoot ( ) ;
78
+ const root = Fantom . createRoot ( ) ;
79
79
80
80
let maybeNode ;
81
81
82
- ReactNativeTester . runTask ( ( ) => {
82
+ Fantom . runTask ( ( ) => {
83
83
root . render (
84
84
< View
85
85
ref = { node => {
@@ -96,7 +96,7 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
96
96
// We don't support view commands in Fantom yet, so we have to mock this.
97
97
TextInputState . focusTextInput = focusTextInput ;
98
98
99
- ReactNativeTester . runTask ( ( ) => {
99
+ Fantom . runTask ( ( ) => {
100
100
node . focus ( ) ;
101
101
} ) ;
102
102
@@ -107,11 +107,11 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
107
107
108
108
describe ( 'measure' , ( ) => {
109
109
it ( 'component.measure(...) invokes callback' , ( ) => {
110
- const root = ReactNativeTester . createRoot ( ) ;
110
+ const root = Fantom . createRoot ( ) ;
111
111
112
112
let maybeNode ;
113
113
114
- ReactNativeTester . runTask ( ( ) => {
114
+ Fantom . runTask ( ( ) => {
115
115
root . render (
116
116
< View
117
117
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -132,11 +132,11 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
132
132
} ) ;
133
133
134
134
it ( 'unmounted.measure(...) does nothing' , ( ) => {
135
- const root = ReactNativeTester . createRoot ( ) ;
135
+ const root = Fantom . createRoot ( ) ;
136
136
137
137
let maybeNode ;
138
138
139
- ReactNativeTester . runTask ( ( ) => {
139
+ Fantom . runTask ( ( ) => {
140
140
root . render (
141
141
< View
142
142
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -149,7 +149,7 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
149
149
150
150
const node = nullthrows ( maybeNode ) ;
151
151
152
- ReactNativeTester . runTask ( ( ) => {
152
+ Fantom . runTask ( ( ) => {
153
153
root . render ( < > </ > ) ;
154
154
} ) ;
155
155
@@ -162,11 +162,11 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
162
162
163
163
describe ( 'measureInWindow' , ( ) => {
164
164
it ( 'component.measureInWindow(...) invokes callback' , ( ) => {
165
- const root = ReactNativeTester . createRoot ( ) ;
165
+ const root = Fantom . createRoot ( ) ;
166
166
167
167
let maybeNode ;
168
168
169
- ReactNativeTester . runTask ( ( ) => {
169
+ Fantom . runTask ( ( ) => {
170
170
root . render (
171
171
< View
172
172
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -187,11 +187,11 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
187
187
} ) ;
188
188
189
189
it ( 'unmounted.measureInWindow(...) does nothing' , ( ) => {
190
- const root = ReactNativeTester . createRoot ( ) ;
190
+ const root = Fantom . createRoot ( ) ;
191
191
192
192
let maybeNode ;
193
193
194
- ReactNativeTester . runTask ( ( ) => {
194
+ Fantom . runTask ( ( ) => {
195
195
root . render (
196
196
< View
197
197
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -204,7 +204,7 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
204
204
205
205
const node = nullthrows ( maybeNode ) ;
206
206
207
- ReactNativeTester . runTask ( ( ) => {
207
+ Fantom . runTask ( ( ) => {
208
208
root . render ( < > </ > ) ;
209
209
} ) ;
210
210
@@ -217,12 +217,12 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
217
217
218
218
describe ( 'measureLayout' , ( ) => {
219
219
it ( 'component.measureLayout(component, ...) invokes callback' , ( ) => {
220
- const root = ReactNativeTester . createRoot ( ) ;
220
+ const root = Fantom . createRoot ( ) ;
221
221
222
222
let maybeParentNode ;
223
223
let maybeChildNode ;
224
224
225
- ReactNativeTester . runTask ( ( ) => {
225
+ Fantom . runTask ( ( ) => {
226
226
root . render (
227
227
< View
228
228
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -250,12 +250,12 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
250
250
} ) ;
251
251
252
252
it ( 'unmounted.measureLayout(component, ...) does nothing' , ( ) => {
253
- const root = ReactNativeTester . createRoot ( ) ;
253
+ const root = Fantom . createRoot ( ) ;
254
254
255
255
let maybeParentNode ;
256
256
let maybeChildNode ;
257
257
258
- ReactNativeTester . runTask ( ( ) => {
258
+ Fantom . runTask ( ( ) => {
259
259
root . render (
260
260
< View
261
261
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -275,7 +275,7 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
275
275
const parentNode = nullthrows ( maybeParentNode ) ;
276
276
const childNode = nullthrows ( maybeChildNode ) ;
277
277
278
- ReactNativeTester . runTask ( ( ) => {
278
+ Fantom . runTask ( ( ) => {
279
279
root . render (
280
280
< View style = { { width : 100 , height : 100 , left : 10 , top : 10 } } /> ,
281
281
) ;
@@ -288,12 +288,12 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
288
288
} ) ;
289
289
290
290
it ( 'component.measureLayout(unmounted, ...) does nothing' , ( ) => {
291
- const root = ReactNativeTester . createRoot ( ) ;
291
+ const root = Fantom . createRoot ( ) ;
292
292
293
293
let maybeParentNode ;
294
294
let maybeChildNode ;
295
295
296
- ReactNativeTester . runTask ( ( ) => {
296
+ Fantom . runTask ( ( ) => {
297
297
root . render (
298
298
< View
299
299
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -313,7 +313,7 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
313
313
const parentNode = nullthrows ( maybeParentNode ) ;
314
314
const childNode = nullthrows ( maybeChildNode ) ;
315
315
316
- ReactNativeTester . runTask ( ( ) => {
316
+ Fantom . runTask ( ( ) => {
317
317
root . render (
318
318
< View style = { { width : 100 , height : 100 , left : 10 , top : 10 } } /> ,
319
319
) ;
@@ -326,12 +326,12 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
326
326
} ) ;
327
327
328
328
it ( 'unmounted.measureLayout(unmounted, ...) does nothing' , ( ) => {
329
- const root = ReactNativeTester . createRoot ( ) ;
329
+ const root = Fantom . createRoot ( ) ;
330
330
331
331
let maybeParentNode ;
332
332
let maybeChildNode ;
333
333
334
- ReactNativeTester . runTask ( ( ) => {
334
+ Fantom . runTask ( ( ) => {
335
335
root . render (
336
336
< View
337
337
style = { { width : 100 , height : 100 , left : 10 , top : 10 } }
@@ -351,7 +351,7 @@ export default function setUpTests({isModern}: {isModern: boolean}) {
351
351
const parentNode = nullthrows ( maybeParentNode ) ;
352
352
const childNode = nullthrows ( maybeChildNode ) ;
353
353
354
- ReactNativeTester . runTask ( ( ) => {
354
+ Fantom . runTask ( ( ) => {
355
355
root . render ( < > </ > ) ;
356
356
} ) ;
357
357
0 commit comments