@@ -69,14 +69,14 @@ describe('ProfilerContext', () => {
69
69
70
70
const Contexts = ( {
71
71
children = null ,
72
- defaultSelectedElementID = null ,
73
- defaultSelectedElementIndex = null ,
72
+ defaultInspectedElementID = null ,
73
+ defaultInspectedElementIndex = null ,
74
74
} : any ) => (
75
75
< BridgeContext . Provider value = { bridge } >
76
76
< StoreContext . Provider value = { store } >
77
77
< TreeContextController
78
- defaultSelectedElementID = { defaultSelectedElementID }
79
- defaultSelectedElementIndex = { defaultSelectedElementIndex } >
78
+ defaultInspectedElementID = { defaultInspectedElementID }
79
+ defaultInspectedElementIndex = { defaultInspectedElementIndex } >
80
80
< ProfilerContextController > { children } </ ProfilerContextController >
81
81
</ TreeContextController >
82
82
</ StoreContext . Provider >
@@ -225,8 +225,8 @@ describe('ProfilerContext', () => {
225
225
await utils . actAsync ( ( ) =>
226
226
TestRenderer . create (
227
227
< Contexts
228
- defaultSelectedElementID = { store . getElementIDAtIndex ( 3 ) }
229
- defaultSelectedElementIndex = { 3 } >
228
+ defaultInspectedElementID = { store . getElementIDAtIndex ( 3 ) }
229
+ defaultInspectedElementIndex = { 3 } >
230
230
< ContextReader />
231
231
</ Contexts > ,
232
232
) ,
@@ -276,8 +276,8 @@ describe('ProfilerContext', () => {
276
276
await utils . actAsync ( ( ) =>
277
277
TestRenderer . create (
278
278
< Contexts
279
- defaultSelectedElementID = { store . getElementIDAtIndex ( 3 ) }
280
- defaultSelectedElementIndex = { 3 } >
279
+ defaultInspectedElementID = { store . getElementIDAtIndex ( 3 ) }
280
+ defaultInspectedElementIndex = { 3 } >
281
281
< ContextReader />
282
282
</ Contexts > ,
283
283
) ,
@@ -323,8 +323,8 @@ describe('ProfilerContext', () => {
323
323
await utils . actAsync ( ( ) =>
324
324
TestRenderer . create (
325
325
< Contexts
326
- defaultSelectedElementID = { store . getElementIDAtIndex ( 3 ) }
327
- defaultSelectedElementIndex = { 3 } >
326
+ defaultInspectedElementID = { store . getElementIDAtIndex ( 3 ) }
327
+ defaultInspectedElementIndex = { 3 } >
328
328
< ContextReader />
329
329
</ Contexts > ,
330
330
) ,
@@ -374,8 +374,8 @@ describe('ProfilerContext', () => {
374
374
await utils . actAsync ( ( ) =>
375
375
TestRenderer . create (
376
376
< Contexts
377
- defaultSelectedElementID = { store . getElementIDAtIndex ( 3 ) }
378
- defaultSelectedElementIndex = { 3 } >
377
+ defaultInspectedElementID = { store . getElementIDAtIndex ( 3 ) }
378
+ defaultInspectedElementIndex = { 3 } >
379
379
< ContextReader />
380
380
</ Contexts > ,
381
381
) ,
@@ -415,11 +415,12 @@ describe('ProfilerContext', () => {
415
415
416
416
let context : Context = ( ( null : any ) : Context ) ;
417
417
let dispatch : DispatcherContext = ( ( null : any ) : DispatcherContext ) ;
418
- let selectedElementID = null ;
418
+ let inspectedElementID = null ;
419
419
function ContextReader ( ) {
420
420
context = React . useContext ( ProfilerContext ) ;
421
421
dispatch = React . useContext ( TreeDispatcherContext ) ;
422
- selectedElementID = React . useContext ( TreeStateContext ) . selectedElementID ;
422
+ inspectedElementID =
423
+ React . useContext ( TreeStateContext ) . inspectedElementID ;
423
424
return null ;
424
425
}
425
426
@@ -428,13 +429,15 @@ describe('ProfilerContext', () => {
428
429
// Select an element within the second root.
429
430
await utils . actAsync ( ( ) =>
430
431
TestRenderer . create (
431
- < Contexts defaultSelectedElementID = { id } defaultSelectedElementIndex = { 3 } >
432
+ < Contexts
433
+ defaultInspectedElementID = { id }
434
+ defaultInspectedElementIndex = { 3 } >
432
435
< ContextReader />
433
436
</ Contexts > ,
434
437
) ,
435
438
) ;
436
439
437
- expect ( selectedElementID ) . toBe ( id ) ;
440
+ expect ( inspectedElementID ) . toBe ( id ) ;
438
441
439
442
// Profile and record more updates to both roots
440
443
await utils . actAsync ( ( ) => store . profilerStore . startProfiling ( ) ) ;
@@ -448,7 +451,7 @@ describe('ProfilerContext', () => {
448
451
utils . act ( ( ) => dispatch ( { type : 'SELECT_ELEMENT_AT_INDEX' , payload : 0 } ) ) ;
449
452
450
453
// Verify that the initial Profiler root selection is maintained.
451
- expect ( selectedElementID ) . toBe ( otherID ) ;
454
+ expect ( inspectedElementID ) . toBe ( otherID ) ;
452
455
expect ( context ) . not . toBeNull ( ) ;
453
456
expect ( context . rootID ) . toBe ( store . getRootIDForElement ( id ) ) ;
454
457
} ) ;
@@ -484,11 +487,12 @@ describe('ProfilerContext', () => {
484
487
485
488
let context : Context = ( ( null : any ) : Context ) ;
486
489
let dispatch : DispatcherContext = ( ( null : any ) : DispatcherContext ) ;
487
- let selectedElementID = null ;
490
+ let inspectedElementID = null ;
488
491
function ContextReader ( ) {
489
492
context = React . useContext ( ProfilerContext ) ;
490
493
dispatch = React . useContext ( TreeDispatcherContext ) ;
491
- selectedElementID = React . useContext ( TreeStateContext ) . selectedElementID ;
494
+ inspectedElementID =
495
+ React . useContext ( TreeStateContext ) . inspectedElementID ;
492
496
return null ;
493
497
}
494
498
@@ -497,13 +501,15 @@ describe('ProfilerContext', () => {
497
501
// Select an element within the second root.
498
502
await utils . actAsync ( ( ) =>
499
503
TestRenderer . create (
500
- < Contexts defaultSelectedElementID = { id } defaultSelectedElementIndex = { 3 } >
504
+ < Contexts
505
+ defaultInspectedElementID = { id }
506
+ defaultInspectedElementIndex = { 3 } >
501
507
< ContextReader />
502
508
</ Contexts > ,
503
509
) ,
504
510
) ;
505
511
506
- expect ( selectedElementID ) . toBe ( id ) ;
512
+ expect ( inspectedElementID ) . toBe ( id ) ;
507
513
508
514
// Profile and record more updates to both roots
509
515
await utils . actAsync ( ( ) => store . profilerStore . startProfiling ( ) ) ;
@@ -517,7 +523,7 @@ describe('ProfilerContext', () => {
517
523
utils . act ( ( ) => dispatch ( { type : 'SELECT_ELEMENT_AT_INDEX' , payload : 0 } ) ) ;
518
524
519
525
// Verify that the initial Profiler root selection is maintained.
520
- expect ( selectedElementID ) . toBe ( otherID ) ;
526
+ expect ( inspectedElementID ) . toBe ( otherID ) ;
521
527
expect ( context ) . not . toBeNull ( ) ;
522
528
expect ( context . rootID ) . toBe ( store . getRootIDForElement ( id ) ) ;
523
529
} ) ;
@@ -553,10 +559,11 @@ describe('ProfilerContext', () => {
553
559
` ) ;
554
560
555
561
let context : Context = ( ( null : any ) : Context ) ;
556
- let selectedElementID = null ;
562
+ let inspectedElementID = null ;
557
563
function ContextReader ( ) {
558
564
context = React . useContext ( ProfilerContext ) ;
559
- selectedElementID = React . useContext ( TreeStateContext ) . selectedElementID ;
565
+ inspectedElementID =
566
+ React . useContext ( TreeStateContext ) . inspectedElementID ;
560
567
return null ;
561
568
}
562
569
@@ -567,14 +574,14 @@ describe('ProfilerContext', () => {
567
574
</ Contexts > ,
568
575
) ,
569
576
) ;
570
- expect ( selectedElementID ) . toBeNull ( ) ;
577
+ expect ( inspectedElementID ) . toBeNull ( ) ;
571
578
572
579
// Select an element in the Profiler tab and verify that the selection is synced to the Components tab.
573
580
await utils . actAsync ( ( ) => context . selectFiber ( parentID , 'Parent' ) ) ;
574
- expect ( selectedElementID ) . toBe ( parentID ) ;
581
+ expect ( inspectedElementID ) . toBe ( parentID ) ;
575
582
576
583
// Select an unmounted element and verify no Components tab selection doesn't change.
577
584
await utils . actAsync ( ( ) => context . selectFiber ( childID , 'Child' ) ) ;
578
- expect ( selectedElementID ) . toBe ( parentID ) ;
585
+ expect ( inspectedElementID ) . toBe ( parentID ) ;
579
586
} ) ;
580
587
} ) ;
0 commit comments