@@ -537,6 +537,9 @@ describe('InspectedElementContext', () => {
537537 const objectOfObjects = {
538538 inner : { string : 'abc' , number : 123 , boolean : true } ,
539539 } ;
540+ const objectWithSymbol = {
541+ [ Symbol ( 'name' ) ] : 'hello' ,
542+ } ;
540543 const typedArray = Int8Array . from ( [ 100 , - 100 , 0 ] ) ;
541544 const arrayBuffer = typedArray . buffer ;
542545 const dataView = new DataView ( arrayBuffer ) ;
@@ -580,6 +583,7 @@ describe('InspectedElementContext', () => {
580583 map = { mapShallow }
581584 map_of_maps = { mapOfMaps }
582585 object_of_objects = { objectOfObjects }
586+ object_with_symbol = { objectWithSymbol }
583587 proxy = { proxyInstance }
584588 react_element = { < span /> }
585589 regexp = { / a b c / giu}
@@ -633,6 +637,7 @@ describe('InspectedElementContext', () => {
633637 map,
634638 map_of_maps,
635639 object_of_objects,
640+ object_with_symbol,
636641 proxy,
637642 react_element,
638643 regexp,
@@ -737,6 +742,8 @@ describe('InspectedElementContext', () => {
737742 ) ;
738743 expect ( object_of_objects . inner [ meta . preview_short ] ) . toBe ( '{…}' ) ;
739744
745+ expect ( object_with_symbol [ 'Symbol(name)' ] ) . toBe ( 'hello' ) ;
746+
740747 expect ( proxy [ meta . inspectable ] ) . toBe ( false ) ;
741748 expect ( proxy [ meta . name ] ) . toBe ( 'function' ) ;
742749 expect ( proxy [ meta . type ] ) . toBe ( 'function' ) ;
@@ -939,6 +946,111 @@ describe('InspectedElementContext', () => {
939946 done ( ) ;
940947 } ) ;
941948
949+ it ( 'should support objects with with inherited keys' , async done => {
950+ const Example = ( ) => null ;
951+
952+ const base = Object . create ( Object . prototype , {
953+ enumerableStringBase : {
954+ value : 1 ,
955+ writable : true ,
956+ enumerable : true ,
957+ configurable : true ,
958+ } ,
959+ [ Symbol ( 'enumerableSymbolBase' ) ] : {
960+ value : 1 ,
961+ writable : true ,
962+ enumerable : true ,
963+ configurable : true ,
964+ } ,
965+ nonEnumerableStringBase : {
966+ value : 1 ,
967+ writable : true ,
968+ enumerable : false ,
969+ configurable : true ,
970+ } ,
971+ [ Symbol ( 'nonEnumerableSymbolBase' ) ] : {
972+ value : 1 ,
973+ writable : true ,
974+ enumerable : false ,
975+ configurable : true ,
976+ } ,
977+ } ) ;
978+
979+ const object = Object . create ( base , {
980+ enumerableString : {
981+ value : 2 ,
982+ writable : true ,
983+ enumerable : true ,
984+ configurable : true ,
985+ } ,
986+ nonEnumerableString : {
987+ value : 3 ,
988+ writable : true ,
989+ enumerable : false ,
990+ configurable : true ,
991+ } ,
992+ [ 123 ] : {
993+ value : 3 ,
994+ writable : true ,
995+ enumerable : true ,
996+ configurable : true ,
997+ } ,
998+ [ Symbol ( 'nonEnumerableSymbol' ) ] : {
999+ value : 2 ,
1000+ writable : true ,
1001+ enumerable : false ,
1002+ configurable : true ,
1003+ } ,
1004+ [ Symbol ( 'enumerableSymbol' ) ] : {
1005+ value : 3 ,
1006+ writable : true ,
1007+ enumerable : true ,
1008+ configurable : true ,
1009+ } ,
1010+ } ) ;
1011+
1012+ const container = document . createElement ( 'div' ) ;
1013+ await utils . actAsync ( ( ) =>
1014+ ReactDOM . render ( < Example object = { object } /> , container ) ,
1015+ ) ;
1016+
1017+ const id = ( ( store . getElementIDAtIndex ( 0 ) : any ) : number ) ;
1018+
1019+ let inspectedElement = null ;
1020+
1021+ function Suspender ( { target} ) {
1022+ const { getInspectedElement} = React . useContext ( InspectedElementContext ) ;
1023+ inspectedElement = getInspectedElement ( id ) ;
1024+ return null ;
1025+ }
1026+
1027+ await utils . actAsync (
1028+ ( ) =>
1029+ TestRenderer . create (
1030+ < Contexts
1031+ defaultSelectedElementID = { id }
1032+ defaultSelectedElementIndex = { 0 } >
1033+ < React . Suspense fallback = { null } >
1034+ < Suspender target = { id } />
1035+ </ React . Suspense >
1036+ </ Contexts > ,
1037+ ) ,
1038+ false ,
1039+ ) ;
1040+
1041+ expect ( inspectedElement ) . not . toBeNull ( ) ;
1042+ expect ( inspectedElement ) . toMatchSnapshot ( `1: Inspected element ${ id } ` ) ;
1043+ expect ( inspectedElement . props . object ) . toEqual ( {
1044+ 123 : 3 ,
1045+ 'Symbol(enumerableSymbol)' : 3 ,
1046+ 'Symbol(enumerableSymbolBase)' : 1 ,
1047+ enumerableString : 2 ,
1048+ enumerableStringBase : 1 ,
1049+ } ) ;
1050+
1051+ done ( ) ;
1052+ } ) ;
1053+
9421054 it ( 'should not dehydrate nested values until explicitly requested' , async done => {
9431055 const Example = ( ) => {
9441056 const [ state ] = React . useState ( {
0 commit comments