File tree 7 files changed +156
-37
lines changed
fixtures/devtools/standalone
react-devtools-shared/src/__tests__
react-devtools-shell/src/app/InspectableElements
7 files changed +156
-37
lines changed Original file line number Diff line number Diff line change @@ -209,54 +209,67 @@ <h1>List</h1>
209
209
}
210
210
211
211
const baseInheritedKeys = Object . create ( Object . prototype , {
212
- value1 : {
212
+ enumerableStringBase : {
213
213
value : 1 ,
214
214
writable : true ,
215
215
enumerable : true ,
216
216
configurable : true ,
217
217
} ,
218
- [ Symbol ( 'value1 ' ) ] : {
218
+ [ Symbol ( 'enumerableSymbolBase ' ) ] : {
219
219
value : 1 ,
220
220
writable : true ,
221
221
enumerable : true ,
222
222
configurable : true ,
223
223
} ,
224
+ nonEnumerableStringBase : {
225
+ value : 1 ,
226
+ writable : true ,
227
+ enumerable : false ,
228
+ configurable : true ,
229
+ } ,
230
+ [ Symbol ( 'nonEnumerableSymbolBase' ) ] : {
231
+ value : 1 ,
232
+ writable : true ,
233
+ enumerable : false ,
234
+ configurable : true ,
235
+ } ,
224
236
} ) ;
225
237
226
238
const inheritedKeys = Object . create ( baseInheritedKeys , {
227
- value2 : {
239
+ enumerableString : {
228
240
value : 2 ,
229
241
writable : true ,
230
242
enumerable : true ,
231
243
configurable : true ,
232
244
} ,
233
- value3 : {
245
+ nonEnumerableString : {
234
246
value : 3 ,
235
247
writable : true ,
236
248
enumerable : false ,
237
249
configurable : true ,
238
250
} ,
239
- 3 : {
251
+ 123 : {
240
252
value : 3 ,
241
253
writable : true ,
242
254
enumerable : true ,
243
255
configurable : true ,
244
256
} ,
245
- [ Symbol ( 'value2 ' ) ] : {
257
+ [ Symbol ( 'nonEnumerableSymbol ' ) ] : {
246
258
value : 2 ,
247
259
writable : true ,
248
260
enumerable : false ,
249
261
configurable : true ,
250
262
} ,
251
- [ Symbol ( 'value3 ' ) ] : {
263
+ [ Symbol ( 'enumerableSymbol ' ) ] : {
252
264
value : 3 ,
253
265
writable : true ,
254
266
enumerable : true ,
255
267
configurable : true ,
256
268
} ,
257
269
} ) ;
270
+
258
271
function InheritedKeys ( ) {
259
- return < ChildComponent inheritedKeys = { inheritedKeys } /> ;
272
+ return < ChildComponent data = { inheritedKeys } /> ;
260
273
}
261
274
262
275
const object = {
Original file line number Diff line number Diff line change @@ -623,11 +623,11 @@ exports[`InspectedElementContext should support objects with with inherited keys
623
623
" hooks" : null ,
624
624
" props" : {
625
625
" object" : {
626
- " 3 " : 3 ,
627
- " value2 " : 2 ,
628
- " Symbol(value3 )" : 3 ,
629
- " value1 " : 1 ,
630
- " Symbol(value1 )" : 1
626
+ " 123 " : 3 ,
627
+ " enumerableString " : 2 ,
628
+ " Symbol(enumerableSymbol )" : 3 ,
629
+ " enumerableStringBase " : 1 ,
630
+ " Symbol(enumerableSymbolBase )" : 1
631
631
}
632
632
},
633
633
" state" : null
Original file line number Diff line number Diff line change @@ -945,52 +945,65 @@ describe('InspectedElementContext', () => {
945
945
const Example = ( ) => null ;
946
946
947
947
const base = Object . create ( Object . prototype , {
948
- value1 : {
948
+ enumerableStringBase : {
949
949
value : 1 ,
950
950
writable : true ,
951
951
enumerable : true ,
952
952
configurable : true ,
953
953
} ,
954
- [ Symbol ( 'value1 ' ) ] : {
954
+ [ Symbol ( 'enumerableSymbolBase ' ) ] : {
955
955
value : 1 ,
956
956
writable : true ,
957
957
enumerable : true ,
958
958
configurable : true ,
959
959
} ,
960
+ nonEnumerableStringBase : {
961
+ value : 1 ,
962
+ writable : true ,
963
+ enumerable : false ,
964
+ configurable : true ,
965
+ } ,
966
+ [ Symbol ( 'nonEnumerableSymbolBase' ) ] : {
967
+ value : 1 ,
968
+ writable : true ,
969
+ enumerable : false ,
970
+ configurable : true ,
971
+ } ,
960
972
} ) ;
961
973
962
974
const object = Object . create ( base , {
963
- value2 : {
975
+ enumerableString : {
964
976
value : 2 ,
965
977
writable : true ,
966
978
enumerable : true ,
967
979
configurable : true ,
968
980
} ,
969
- value3 : {
981
+ nonEnumerableString : {
970
982
value : 3 ,
971
983
writable : true ,
972
984
enumerable : false ,
973
985
configurable : true ,
974
986
} ,
975
- 3 : {
987
+ [ 123 ] : {
976
988
value : 3 ,
977
989
writable : true ,
978
990
enumerable : true ,
979
991
configurable : true ,
980
992
} ,
981
- [ Symbol ( 'value2 ' ) ] : {
993
+ [ Symbol ( 'nonEnumerableSymbol ' ) ] : {
982
994
value : 2 ,
983
995
writable : true ,
984
996
enumerable : false ,
985
997
configurable : true ,
986
998
} ,
987
- [ Symbol ( 'value3 ' ) ] : {
999
+ [ Symbol ( 'enumerableSymbol ' ) ] : {
988
1000
value : 3 ,
989
1001
writable : true ,
990
1002
enumerable : true ,
991
1003
configurable : true ,
992
1004
} ,
993
1005
} ) ;
1006
+
994
1007
const container = document . createElement ( 'div' ) ;
995
1008
await utils . actAsync ( ( ) =>
996
1009
ReactDOM . render ( < Example object = { object } /> , container ) ,
@@ -1023,11 +1036,11 @@ describe('InspectedElementContext', () => {
1023
1036
expect ( inspectedElement ) . not . toBeNull ( ) ;
1024
1037
expect ( inspectedElement ) . toMatchSnapshot ( `1: Inspected element ${ id } ` ) ;
1025
1038
expect ( inspectedElement . props . object ) . toEqual ( {
1026
- '3' : 3 ,
1027
- 'Symbol(value1 )' : 1 ,
1028
- 'Symbol(value3 )' : 3 ,
1029
- value1 : 1 ,
1030
- value2 : 2 ,
1039
+ 123 : 3 ,
1040
+ 'Symbol(enumerableSymbol )' : 3 ,
1041
+ 'Symbol(enumerableSymbolBase )' : 1 ,
1042
+ enumerableString : 2 ,
1043
+ enumerableStringBase : 1 ,
1031
1044
} ) ;
1032
1045
1033
1046
done ( ) ;
Original file line number Diff line number Diff line change @@ -247,11 +247,11 @@ Object {
247
247
" hooks" : null ,
248
248
" props" : {
249
249
" data" : {
250
- " 3 " : 3 ,
251
- " value2 " : 2 ,
252
- " Symbol(value3 )" : 3 ,
253
- " value1 " : 1 ,
254
- " Symbol(value1 )" : 1
250
+ " 123 " : 3 ,
251
+ " enumerableString " : 2 ,
252
+ " Symbol(enumerableSymbol )" : 3 ,
253
+ " enumerableStringBase " : 1 ,
254
+ " Symbol(enumerableSymbolBase )" : 1
255
255
}
256
256
},
257
257
" state" : null
Original file line number Diff line number Diff line change @@ -436,52 +436,65 @@ describe('InspectedElementContext', () => {
436
436
const Example = ( ) => null ;
437
437
438
438
const base = Object . create ( Object . prototype , {
439
- value1 : {
439
+ enumerableStringBase : {
440
440
value : 1 ,
441
441
writable : true ,
442
442
enumerable : true ,
443
443
configurable : true ,
444
444
} ,
445
- [ Symbol ( 'value1 ' ) ] : {
445
+ [ Symbol ( 'enumerableSymbolBase ' ) ] : {
446
446
value : 1 ,
447
447
writable : true ,
448
448
enumerable : true ,
449
449
configurable : true ,
450
450
} ,
451
+ nonEnumerableStringBase : {
452
+ value : 1 ,
453
+ writable : true ,
454
+ enumerable : false ,
455
+ configurable : true ,
456
+ } ,
457
+ [ Symbol ( 'nonEnumerableSymbolBase' ) ] : {
458
+ value : 1 ,
459
+ writable : true ,
460
+ enumerable : false ,
461
+ configurable : true ,
462
+ } ,
451
463
} ) ;
452
464
453
465
const object = Object . create ( base , {
454
- value2 : {
466
+ enumerableString : {
455
467
value : 2 ,
456
468
writable : true ,
457
469
enumerable : true ,
458
470
configurable : true ,
459
471
} ,
460
- value3 : {
472
+ nonEnumerableString : {
461
473
value : 3 ,
462
474
writable : true ,
463
475
enumerable : false ,
464
476
configurable : true ,
465
477
} ,
466
- 3 : {
478
+ [ 123 ] : {
467
479
value : 3 ,
468
480
writable : true ,
469
481
enumerable : true ,
470
482
configurable : true ,
471
483
} ,
472
- [ Symbol ( 'value2 ' ) ] : {
484
+ [ Symbol ( 'nonEnumerableSymbol ' ) ] : {
473
485
value : 2 ,
474
486
writable : true ,
475
487
enumerable : false ,
476
488
configurable : true ,
477
489
} ,
478
- [ Symbol ( 'value3 ' ) ] : {
490
+ [ Symbol ( 'enumerableSymbol ' ) ] : {
479
491
value : 3 ,
480
492
writable : true ,
481
493
enumerable : true ,
482
494
configurable : true ,
483
495
} ,
484
496
} ) ;
497
+
485
498
act ( ( ) =>
486
499
ReactDOM . render ( < Example data = { object } /> , document . createElement ( 'div' ) ) ,
487
500
) ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import CustomObject from './CustomObject';
17
17
import EdgeCaseObjects from './EdgeCaseObjects.js' ;
18
18
import NestedProps from './NestedProps' ;
19
19
import SimpleValues from './SimpleValues' ;
20
+ import SymbolKeys from './SymbolKeys' ;
20
21
21
22
// TODO Add Immutable JS example
22
23
@@ -32,6 +33,7 @@ export default function InspectableElements() {
32
33
< CustomObject />
33
34
< EdgeCaseObjects />
34
35
< CircularReferences />
36
+ < SymbolKeys />
35
37
</ Fragment >
36
38
) ;
37
39
}
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow
8
+ */
9
+
10
+ import * as React from 'react' ;
11
+
12
+ const base = Object . create ( Object . prototype , {
13
+ enumerableStringBase : {
14
+ value : 1 ,
15
+ writable : true ,
16
+ enumerable : true ,
17
+ configurable : true ,
18
+ } ,
19
+ [ Symbol ( 'enumerableSymbolBase' ) ] : {
20
+ value : 1 ,
21
+ writable : true ,
22
+ enumerable : true ,
23
+ configurable : true ,
24
+ } ,
25
+ nonEnumerableStringBase : {
26
+ value : 1 ,
27
+ writable : true ,
28
+ enumerable : false ,
29
+ configurable : true ,
30
+ } ,
31
+ [ Symbol ( 'nonEnumerableSymbolBase' ) ] : {
32
+ value : 1 ,
33
+ writable : true ,
34
+ enumerable : false ,
35
+ configurable : true ,
36
+ } ,
37
+ } ) ;
38
+
39
+ const data = Object . create ( base , {
40
+ enumerableString : {
41
+ value : 2 ,
42
+ writable : true ,
43
+ enumerable : true ,
44
+ configurable : true ,
45
+ } ,
46
+ nonEnumerableString : {
47
+ value : 3 ,
48
+ writable : true ,
49
+ enumerable : false ,
50
+ configurable : true ,
51
+ } ,
52
+ [ 123 ] : {
53
+ value : 3 ,
54
+ writable : true ,
55
+ enumerable : true ,
56
+ configurable : true ,
57
+ } ,
58
+ [ Symbol ( 'nonEnumerableSymbol' ) ] : {
59
+ value : 2 ,
60
+ writable : true ,
61
+ enumerable : false ,
62
+ configurable : true ,
63
+ } ,
64
+ [ Symbol ( 'enumerableSymbol' ) ] : {
65
+ value : 3 ,
66
+ writable : true ,
67
+ enumerable : true ,
68
+ configurable : true ,
69
+ } ,
70
+ } ) ;
71
+
72
+ export default function SymbolKeys ( ) {
73
+ return < ChildComponent data = { data } /> ;
74
+ }
75
+
76
+ function ChildComponent ( props : any ) {
77
+ return null ;
78
+ }
You can’t perform that action at this time.
0 commit comments