@@ -295,6 +295,62 @@ test('parent-child switching from unflattened-flattened to flattened-unflattened
295
295
] ) ;
296
296
} ) ;
297
297
298
+ test ( 'parent-child switching from flattened-unflattened to unflattened-flattened' , ( ) => {
299
+ const root = Fantom . createRoot ( ) ;
300
+
301
+ Fantom . runTask ( ( ) => {
302
+ root . render (
303
+ < View
304
+ style = { {
305
+ marginTop : 100 ,
306
+ } } >
307
+ < View
308
+ style = { {
309
+ marginTop : 50 ,
310
+ opacity : 0 ,
311
+ } } >
312
+ < View nativeID = { 'child' } style = { { height : 10 , width : 10 } } />
313
+ </ View >
314
+ </ View > ,
315
+ ) ;
316
+ } ) ;
317
+
318
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
319
+ 'Update {type: "RootView", nativeID: (root)}' ,
320
+ 'Create {type: "View", nativeID: (N/A)}' ,
321
+ 'Create {type: "View", nativeID: "child"}' ,
322
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
323
+ 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
324
+ ] ) ;
325
+
326
+ // force view to be flattened.
327
+ Fantom . runTask ( ( ) => {
328
+ root . render (
329
+ < View
330
+ style = { {
331
+ marginTop : 100 ,
332
+ opacity : 0 ,
333
+ } } >
334
+ < View
335
+ style = { {
336
+ marginTop : 50 ,
337
+ } } >
338
+ < View nativeID = { 'child' } style = { { height : 10 , width : 10 } } />
339
+ </ View >
340
+ </ View > ,
341
+ ) ;
342
+ } ) ;
343
+ expect ( root . takeMountingManagerLogs ( ) ) . toEqual ( [
344
+ 'Update {type: "View", nativeID: "child"}' ,
345
+ 'Remove {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
346
+ 'Remove {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
347
+ 'Delete {type: "View", nativeID: (N/A)}' ,
348
+ 'Create {type: "View", nativeID: (N/A)}' ,
349
+ 'Insert {type: "View", parentNativeID: (root), index: 0, nativeID: (N/A)}' ,
350
+ 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "child"}' ,
351
+ ] ) ;
352
+ } ) ;
353
+
298
354
describe ( 'reconciliation of setNativeProps and React commit' , ( ) => {
299
355
it ( 'props set by setNativeProps must not be overriden by React commit' , ( ) => {
300
356
const root = Fantom . createRoot ( ) ;
0 commit comments