10
10
import type { FrontendBridge } from 'react-devtools-shared/src/bridge' ;
11
11
import type Store from 'react-devtools-shared/src/devtools/store' ;
12
12
13
- describe ( 'editable props and state ' , ( ) => {
13
+ describe ( 'editing interface ' , ( ) => {
14
14
let PropTypes ;
15
15
let React ;
16
16
let ReactDOM ;
17
17
let bridge : FrontendBridge ;
18
18
let store : Store ;
19
19
let utils ;
20
20
21
+ const flushPendingUpdates = ( ) => {
22
+ jest . runOnlyPendingTimers ( ) ;
23
+ } ;
24
+
21
25
beforeEach ( ( ) => {
22
26
utils = require ( './utils' ) ;
23
27
@@ -108,7 +112,7 @@ describe('editable props and state', () => {
108
112
type : 'props' ,
109
113
value,
110
114
} ) ;
111
- jest . runOnlyPendingTimers ( ) ;
115
+ flushPendingUpdates ( ) ;
112
116
}
113
117
114
118
overrideProps ( classID , [ 'shallow' ] , 'updated' ) ;
@@ -162,7 +166,8 @@ describe('editable props and state', () => {
162
166
} ) ;
163
167
} ) ;
164
168
165
- it ( 'should still support overriding props values with legacy backend methods' , async ( ) => {
169
+ // Tests the combination of older frontend (DevTools UI) with newer backend (embedded within a renderer).
170
+ it ( 'should still support overriding prop values with legacy backend methods' , async ( ) => {
166
171
await mountTestApp ( ) ;
167
172
168
173
function overrideProps ( id , path , value ) {
@@ -173,7 +178,7 @@ describe('editable props and state', () => {
173
178
rendererID,
174
179
value,
175
180
} ) ;
176
- jest . runOnlyPendingTimers ( ) ;
181
+ flushPendingUpdates ( ) ;
177
182
}
178
183
179
184
overrideProps ( classID , [ 'object' , 'nested' ] , 'updated' ) ;
@@ -207,7 +212,7 @@ describe('editable props and state', () => {
207
212
rendererID,
208
213
type : 'props' ,
209
214
} ) ;
210
- jest . runOnlyPendingTimers ( ) ;
215
+ flushPendingUpdates ( ) ;
211
216
}
212
217
213
218
renamePath ( classID , [ 'shallow' ] , [ 'after' ] ) ;
@@ -257,7 +262,7 @@ describe('editable props and state', () => {
257
262
type : 'props' ,
258
263
value,
259
264
} ) ;
260
- jest . runOnlyPendingTimers ( ) ;
265
+ flushPendingUpdates ( ) ;
261
266
}
262
267
263
268
overrideProps ( classID , [ 'new' ] , 'value' ) ;
@@ -336,7 +341,7 @@ describe('editable props and state', () => {
336
341
rendererID,
337
342
type : 'props' ,
338
343
} ) ;
339
- jest . runOnlyPendingTimers ( ) ;
344
+ flushPendingUpdates ( ) ;
340
345
}
341
346
342
347
deletePath ( classID , [ 'shallow' ] ) ;
@@ -432,7 +437,7 @@ describe('editable props and state', () => {
432
437
type : 'state' ,
433
438
value,
434
439
} ) ;
435
- jest . runOnlyPendingTimers ( ) ;
440
+ flushPendingUpdates ( ) ;
436
441
}
437
442
438
443
overrideState ( [ 'shallow' ] , 'updated' ) ;
@@ -457,6 +462,7 @@ describe('editable props and state', () => {
457
462
} ) ;
458
463
} ) ;
459
464
465
+ // Tests the combination of older frontend (DevTools UI) with newer backend (embedded within a renderer).
460
466
it ( 'should still support overriding state values with legacy backend methods' , async ( ) => {
461
467
await mountTestApp ( ) ;
462
468
@@ -468,7 +474,7 @@ describe('editable props and state', () => {
468
474
rendererID,
469
475
value,
470
476
} ) ;
471
- jest . runOnlyPendingTimers ( ) ;
477
+ flushPendingUpdates ( ) ;
472
478
}
473
479
474
480
overrideState ( [ 'array' , 1 ] , 'updated' ) ;
@@ -491,7 +497,7 @@ describe('editable props and state', () => {
491
497
rendererID,
492
498
type : 'state' ,
493
499
} ) ;
494
- jest . runOnlyPendingTimers ( ) ;
500
+ flushPendingUpdates ( ) ;
495
501
}
496
502
497
503
renamePath ( [ 'shallow' ] , [ 'after' ] ) ;
@@ -525,7 +531,7 @@ describe('editable props and state', () => {
525
531
type : 'state' ,
526
532
value,
527
533
} ) ;
528
- jest . runOnlyPendingTimers ( ) ;
534
+ flushPendingUpdates ( ) ;
529
535
}
530
536
531
537
overrideState ( [ 'new' ] , 'value' ) ;
@@ -572,7 +578,7 @@ describe('editable props and state', () => {
572
578
rendererID,
573
579
type : 'state' ,
574
580
} ) ;
575
- jest . runOnlyPendingTimers ( ) ;
581
+ flushPendingUpdates ( ) ;
576
582
}
577
583
578
584
deletePath ( [ 'shallow' ] ) ;
@@ -647,7 +653,7 @@ describe('editable props and state', () => {
647
653
type : 'hooks' ,
648
654
value,
649
655
} ) ;
650
- jest . runOnlyPendingTimers ( ) ;
656
+ flushPendingUpdates ( ) ;
651
657
}
652
658
653
659
overrideHookState ( [ 'shallow' ] , 'updated' ) ;
@@ -678,7 +684,8 @@ describe('editable props and state', () => {
678
684
} ) ;
679
685
} ) ;
680
686
681
- it ( 'should still support overriding hooks values with legacy backend methods' , async ( ) => {
687
+ // Tests the combination of older frontend (DevTools UI) with newer backend (embedded within a renderer).
688
+ it ( 'should still support overriding hook values with legacy backend methods' , async ( ) => {
682
689
await mountTestApp ( ) ;
683
690
684
691
function overrideHookState ( path , value ) {
@@ -690,7 +697,7 @@ describe('editable props and state', () => {
690
697
rendererID,
691
698
value,
692
699
} ) ;
693
- jest . runOnlyPendingTimers ( ) ;
700
+ flushPendingUpdates ( ) ;
694
701
}
695
702
696
703
overrideHookState ( [ 'shallow' ] , 'updated' ) ;
@@ -716,7 +723,7 @@ describe('editable props and state', () => {
716
723
rendererID,
717
724
type : 'hooks' ,
718
725
} ) ;
719
- jest . runOnlyPendingTimers ( ) ;
726
+ flushPendingUpdates ( ) ;
720
727
}
721
728
722
729
renamePath ( [ 'shallow' ] , [ 'after' ] ) ;
@@ -751,7 +758,7 @@ describe('editable props and state', () => {
751
758
type : 'hooks' ,
752
759
value,
753
760
} ) ;
754
- jest . runOnlyPendingTimers ( ) ;
761
+ flushPendingUpdates ( ) ;
755
762
}
756
763
757
764
overrideHookState ( [ 'new' ] , 'value' ) ;
@@ -799,7 +806,7 @@ describe('editable props and state', () => {
799
806
rendererID,
800
807
type : 'hooks' ,
801
808
} ) ;
802
- jest . runOnlyPendingTimers ( ) ;
809
+ flushPendingUpdates ( ) ;
803
810
}
804
811
805
812
deletePath ( [ 'shallow' ] ) ;
@@ -907,7 +914,7 @@ describe('editable props and state', () => {
907
914
type : 'context' ,
908
915
value,
909
916
} ) ;
910
- jest . runOnlyPendingTimers ( ) ;
917
+ flushPendingUpdates ( ) ;
911
918
}
912
919
913
920
overrideContext ( [ 'shallow' ] , 'updated' ) ;
@@ -938,6 +945,7 @@ describe('editable props and state', () => {
938
945
} ) ;
939
946
} ) ;
940
947
948
+ // Tests the combination of older frontend (DevTools UI) with newer backend (embedded within a renderer).
941
949
it ( 'should still support overriding context values with legacy backend methods' , async ( ) => {
942
950
await mountTestApp ( ) ;
943
951
@@ -954,7 +962,7 @@ describe('editable props and state', () => {
954
962
rendererID,
955
963
value,
956
964
} ) ;
957
- jest . runOnlyPendingTimers ( ) ;
965
+ flushPendingUpdates ( ) ;
958
966
}
959
967
960
968
overrideContext ( [ 'object' , 'nested' ] , 'updated' ) ;
@@ -985,7 +993,7 @@ describe('editable props and state', () => {
985
993
rendererID,
986
994
type : 'context' ,
987
995
} ) ;
988
- jest . runOnlyPendingTimers ( ) ;
996
+ flushPendingUpdates ( ) ;
989
997
}
990
998
991
999
renamePath ( [ 'shallow' ] , [ 'after' ] ) ;
@@ -1024,7 +1032,7 @@ describe('editable props and state', () => {
1024
1032
type : 'context' ,
1025
1033
value,
1026
1034
} ) ;
1027
- jest . runOnlyPendingTimers ( ) ;
1035
+ flushPendingUpdates ( ) ;
1028
1036
}
1029
1037
1030
1038
overrideContext ( [ 'new' ] , 'value' ) ;
@@ -1076,7 +1084,7 @@ describe('editable props and state', () => {
1076
1084
rendererID,
1077
1085
type : 'context' ,
1078
1086
} ) ;
1079
- jest . runOnlyPendingTimers ( ) ;
1087
+ flushPendingUpdates ( ) ;
1080
1088
}
1081
1089
1082
1090
deletePath ( [ 'shallow' ] ) ;
0 commit comments