@@ -176,6 +176,7 @@ describe('InspectedElement', () => {
176176 "a": 1,
177177 "b": "abc",
178178 },
179+ "rootType": "render()",
179180 "state": null,
180181 }
181182 ` ) ;
@@ -1584,6 +1585,7 @@ describe('InspectedElement', () => {
15841585 "a": 1,
15851586 "b": "abc",
15861587 },
1588+ "rootType": "render()",
15871589 "state": null,
15881590 }
15891591 ` ) ;
@@ -1912,6 +1914,7 @@ describe('InspectedElement', () => {
19121914 "id": 2,
19131915 "owners": null,
19141916 "props": Object {},
1917+ "rootType": "render()",
19151918 "state": null,
19161919 }
19171920 ` ) ;
@@ -1944,11 +1947,67 @@ describe('InspectedElement', () => {
19441947 "id": 2,
19451948 "owners": null,
19461949 "props": Object {},
1950+ "rootType": "render()",
19471951 "state": null,
19481952 }
19491953 ` ) ;
19501954 } ) ;
19511955
1956+ it ( 'should display the root type for ReactDOM.hydrate' , async ( ) => {
1957+ const Example = ( ) => < div /> ;
1958+
1959+ await utils . actAsync ( ( ) => {
1960+ const container = document . createElement ( 'div' ) ;
1961+ container . innerHTML = '<div></div>' ;
1962+ withErrorsOrWarningsIgnored (
1963+ [ 'ReactDOM.hydrate is no longer supported in React 18' ] ,
1964+ ( ) => {
1965+ ReactDOM . hydrate ( < Example /> , container ) ;
1966+ } ,
1967+ ) ;
1968+ } , false ) ;
1969+
1970+ const inspectedElement = await inspectElementAtIndex ( 0 ) ;
1971+ expect ( inspectedElement . rootType ) . toMatchInlineSnapshot ( `"hydrate()"` ) ;
1972+ } ) ;
1973+
1974+ it ( 'should display the root type for ReactDOM.render' , async ( ) => {
1975+ const Example = ( ) => < div /> ;
1976+
1977+ await utils . actAsync ( ( ) => {
1978+ const container = document . createElement ( 'div' ) ;
1979+ legacyRender ( < Example /> , container ) ;
1980+ } , false ) ;
1981+
1982+ const inspectedElement = await inspectElementAtIndex ( 0 ) ;
1983+ expect ( inspectedElement . rootType ) . toMatchInlineSnapshot ( `"render()"` ) ;
1984+ } ) ;
1985+
1986+ it ( 'should display the root type for ReactDOM.hydrateRoot' , async ( ) => {
1987+ const Example = ( ) => < div /> ;
1988+
1989+ await utils . actAsync ( ( ) => {
1990+ const container = document . createElement ( 'div' ) ;
1991+ container . innerHTML = '<div></div>' ;
1992+ ReactDOM . hydrateRoot ( container ) . render ( < Example /> ) ;
1993+ } , false ) ;
1994+
1995+ const inspectedElement = await inspectElementAtIndex ( 0 ) ;
1996+ expect ( inspectedElement . rootType ) . toMatchInlineSnapshot ( `"hydrateRoot()"` ) ;
1997+ } ) ;
1998+
1999+ it ( 'should display the root type for ReactDOM.createRoot' , async ( ) => {
2000+ const Example = ( ) => < div /> ;
2001+
2002+ await utils . actAsync ( ( ) => {
2003+ const container = document . createElement ( 'div' ) ;
2004+ ReactDOM . createRoot ( container ) . render ( < Example /> ) ;
2005+ } , false ) ;
2006+
2007+ const inspectedElement = await inspectElementAtIndex ( 0 ) ;
2008+ expect ( inspectedElement . rootType ) . toMatchInlineSnapshot ( `"createRoot()"` ) ;
2009+ } ) ;
2010+
19522011 describe ( '$r' , ( ) => {
19532012 it ( 'should support function components' , async ( ) => {
19542013 const Example = ( ) => {
0 commit comments