@@ -47,12 +47,14 @@ describe("main shortcuts", () => {
4747 hide : vi . fn ( ) ,
4848 focus : vi . fn ( ) ,
4949 } ;
50+ const onVisibilityChange = vi . fn ( ) ;
5051
51- toggleWindowForShowApp ( win as any ) ;
52+ toggleWindowForShowApp ( win as any , onVisibilityChange ) ;
5253
5354 expect ( win . hide ) . toHaveBeenCalledTimes ( 1 ) ;
5455 expect ( win . show ) . not . toHaveBeenCalled ( ) ;
5556 expect ( win . focus ) . not . toHaveBeenCalled ( ) ;
57+ expect ( onVisibilityChange ) . toHaveBeenCalledWith ( false ) ;
5658 } ) ;
5759
5860 it ( "restores and focuses a minimized window for showApp" , async ( ) => {
@@ -65,13 +67,15 @@ describe("main shortcuts", () => {
6567 hide : vi . fn ( ) ,
6668 focus : vi . fn ( ) ,
6769 } ;
70+ const onVisibilityChange = vi . fn ( ) ;
6871
69- toggleWindowForShowApp ( win as any ) ;
72+ toggleWindowForShowApp ( win as any , onVisibilityChange ) ;
7073
7174 expect ( win . restore ) . toHaveBeenCalledTimes ( 1 ) ;
7275 expect ( win . show ) . toHaveBeenCalledTimes ( 1 ) ;
7376 expect ( win . focus ) . toHaveBeenCalledTimes ( 1 ) ;
7477 expect ( win . hide ) . not . toHaveBeenCalled ( ) ;
78+ expect ( onVisibilityChange ) . toHaveBeenCalledWith ( true ) ;
7579 } ) ;
7680
7781 it ( "registers showApp as a true toggle in the global shortcut callback" , async ( ) => {
@@ -100,6 +104,10 @@ describe("main shortcuts", () => {
100104 expect ( mockUnregisterAll ) . toHaveBeenCalledTimes ( 1 ) ;
101105 expect ( mockRegister ) . toHaveBeenCalled ( ) ;
102106 expect ( win . hide ) . toHaveBeenCalledTimes ( 1 ) ;
107+ expect ( win . webContents . send ) . toHaveBeenCalledWith (
108+ "window:visibility-changed" ,
109+ false ,
110+ ) ;
103111 expect ( win . webContents . send ) . toHaveBeenCalledWith (
104112 "shortcut:triggered" ,
105113 "showApp" ,
0 commit comments