@@ -30,7 +30,7 @@ function freshPanel(): PanelModule {
3030const PANEL_RECT = { x : 400 , y : 64 , width : 600 , height : 800 }
3131
3232/** A panel showing one tab. */
33- function showPanel ( panel : PanelModule ) {
33+ function showPanel ( panel : PanelModule , onGeometryChanged ?: ( ) => void ) {
3434 const win = new BrowserWindow ( )
3535 const view = new WebContentsView ( )
3636 const active = { id : 'tab-1' , scopeId : 'chat-test' , view }
@@ -40,6 +40,7 @@ function showPanel(panel: PanelModule) {
4040 backgroundColor : ( ) => '#0c0c0c' ,
4141 restoreActiveScope : ( ) => { } ,
4242 onViewDetached : ( ) => { } ,
43+ onGeometryChanged,
4344 } )
4445 panel . activatePanelScope ( 'chat-test' )
4546 panel . setPanelBounds ( PANEL_RECT , win )
@@ -278,6 +279,20 @@ describe('panel chat scope', () => {
278279 expect ( view . webContents . invalidate ) . toHaveBeenCalledTimes ( 2 )
279280 } )
280281
282+ it ( 'dismisses field-anchored UI when the browser resource is hidden' , ( ) => {
283+ const onGeometryChanged = vi . fn ( )
284+ const { win, view } = showPanel ( panel , onGeometryChanged )
285+ onGeometryChanged . mockClear ( )
286+
287+ panel . setPanelBounds ( null , win )
288+
289+ expect ( view . setVisible ) . toHaveBeenLastCalledWith ( false )
290+ expect ( onGeometryChanged ) . toHaveBeenCalledOnce ( )
291+ expect ( win . contentView . removeChildView ) . not . toHaveBeenCalled ( )
292+ panel . layout ( )
293+ expect ( onGeometryChanged ) . toHaveBeenCalledOnce ( )
294+ } )
295+
281296 it ( 'reports the exact applied native rectangle in renderer viewport coordinates' , async ( ) => {
282297 const { win, view } = showPanel ( panel )
283298 const scopeId = panel . getActivePanelScopeId ( )
0 commit comments