@@ -28,16 +28,23 @@ describe('constructCoreClass', () => {
2828 const [ DevtoolsCore ] = constructCoreClass ( importFn )
2929 const instance = new DevtoolsCore ( )
3030 const el = document . createElement ( 'div' )
31- await instance . mount ( el , 'dark' )
32- expect ( mountComponentMock ) . toHaveBeenCalledWith ( el , 'dark' , importFn )
31+ const props = { theme : 'dark' as const , devtoolsOpen : true }
32+ await instance . mount ( el , props )
33+ expect ( mountComponentMock ) . toHaveBeenCalledWith ( el , props , importFn )
3334 } )
3435
3536 it ( 'DevtoolsCore should throw if mount is called twice without unmounting' , async ( ) => {
3637 const [ DevtoolsCore ] = constructCoreClass ( importFn )
3738 const instance = new DevtoolsCore ( )
38- await instance . mount ( document . createElement ( 'div' ) , 'dark' )
39+ await instance . mount ( document . createElement ( 'div' ) , {
40+ theme : 'dark' ,
41+ devtoolsOpen : true ,
42+ } )
3943 await expect (
40- instance . mount ( document . createElement ( 'div' ) , 'dark' ) ,
44+ instance . mount ( document . createElement ( 'div' ) , {
45+ theme : 'dark' ,
46+ devtoolsOpen : true ,
47+ } ) ,
4148 ) . rejects . toThrow ( 'Devtools is already mounted' )
4249 } )
4350
@@ -50,25 +57,37 @@ describe('constructCoreClass', () => {
5057 it ( 'DevtoolsCore should allow mount after unmount' , async ( ) => {
5158 const [ DevtoolsCore ] = constructCoreClass ( importFn )
5259 const instance = new DevtoolsCore ( )
53- await instance . mount ( document . createElement ( 'div' ) , 'dark' )
60+ await instance . mount ( document . createElement ( 'div' ) , {
61+ theme : 'dark' ,
62+ devtoolsOpen : true ,
63+ } )
5464 instance . unmount ( )
5565 await expect (
56- instance . mount ( document . createElement ( 'div' ) , 'dark' ) ,
66+ instance . mount ( document . createElement ( 'div' ) , {
67+ theme : 'dark' ,
68+ devtoolsOpen : true ,
69+ } ) ,
5770 ) . resolves . not . toThrow ( )
5871 } )
5972
6073 it ( 'DevtoolsCore should call dispose on unmount' , async ( ) => {
6174 const [ DevtoolsCore ] = constructCoreClass ( importFn )
6275 const instance = new DevtoolsCore ( )
63- await instance . mount ( document . createElement ( 'div' ) , 'dark' )
76+ await instance . mount ( document . createElement ( 'div' ) , {
77+ theme : 'dark' ,
78+ devtoolsOpen : true ,
79+ } )
6480 instance . unmount ( )
6581 expect ( disposeMock ) . toHaveBeenCalled ( )
6682 } )
6783
6884 it ( 'DevtoolsCore should abort mount if unmount is called during mounting' , async ( ) => {
6985 const [ DevtoolsCore ] = constructCoreClass ( importFn )
7086 const instance = new DevtoolsCore ( )
71- const mountPromise = instance . mount ( document . createElement ( 'div' ) , 'dark' )
87+ const mountPromise = instance . mount ( document . createElement ( 'div' ) , {
88+ theme : 'dark' ,
89+ devtoolsOpen : true ,
90+ } )
7291 // Unmount while mount is in progress — triggers abort path
7392 // Note: since the mock resolves immediately, this tests the #abortMount flag
7493 await mountPromise
@@ -80,16 +99,25 @@ describe('constructCoreClass', () => {
8099 it ( 'NoOpDevtoolsCore should not call __mountComponent when mount is called' , async ( ) => {
81100 const [ , NoOpDevtoolsCore ] = constructCoreClass ( importFn )
82101 const noOpInstance = new NoOpDevtoolsCore ( )
83- await noOpInstance . mount ( document . createElement ( 'div' ) , 'dark' )
102+ await noOpInstance . mount ( document . createElement ( 'div' ) , {
103+ theme : 'dark' ,
104+ devtoolsOpen : true ,
105+ } )
84106 expect ( mountComponentMock ) . not . toHaveBeenCalled ( )
85107 } )
86108
87109 it ( 'NoOpDevtoolsCore should not throw if mount is called multiple times' , async ( ) => {
88110 const [ , NoOpDevtoolsCore ] = constructCoreClass ( importFn )
89111 const noOpInstance = new NoOpDevtoolsCore ( )
90- await noOpInstance . mount ( document . createElement ( 'div' ) , 'dark' )
112+ await noOpInstance . mount ( document . createElement ( 'div' ) , {
113+ theme : 'dark' ,
114+ devtoolsOpen : true ,
115+ } )
91116 await expect (
92- noOpInstance . mount ( document . createElement ( 'div' ) , 'dark' ) ,
117+ noOpInstance . mount ( document . createElement ( 'div' ) , {
118+ theme : 'dark' ,
119+ devtoolsOpen : true ,
120+ } ) ,
93121 ) . resolves . not . toThrow ( )
94122 } )
95123
@@ -102,7 +130,10 @@ describe('constructCoreClass', () => {
102130 it ( 'NoOpDevtoolsCore should not throw if unmount is called after mount' , async ( ) => {
103131 const [ , NoOpDevtoolsCore ] = constructCoreClass ( importFn )
104132 const noOpInstance = new NoOpDevtoolsCore ( )
105- await noOpInstance . mount ( document . createElement ( 'div' ) , 'dark' )
133+ await noOpInstance . mount ( document . createElement ( 'div' ) , {
134+ theme : 'dark' ,
135+ devtoolsOpen : true ,
136+ } )
106137 expect ( ( ) => noOpInstance . unmount ( ) ) . not . toThrow ( )
107138 } )
108139} )
0 commit comments