@@ -1219,21 +1219,29 @@ it.effect(
12191219 result : { value : { width, height } } ,
12201220 } ) ;
12211221 const resized = ( ) => cdp . emitAsync ( "Page.frameResized" ) ;
1222- // An alert open on attach blocks the first read, which gives up with no size to send.
1222+ // The read on attach never answers and gives up with no size to send.
12231223 const blocked = yield * Queue . take ( reads ) ;
12241224 yield * TestClock . adjust ( "1 second" ) ;
1225- // While it stays open nothing reads again; the host closing it clears it.
1225+ // The next page load measures again.
1226+ desktopSizeAnswer = null ;
1227+ yield * Effect . promise ( ( ) => cdp . emitAsync ( "Page.loadEventFired" ) ) ;
1228+ expect ( viewportSizes ( yield * Queue . takeAll ( viewer . output ) ) ) . toEqual ( [ "1920x1080" ] ) ;
1229+ // While a dialog is open nothing reads. The host closing it clears it, and since
1230+ // closing resizes nothing, the close itself remeasures.
1231+ deferReads ( ) ;
12261232 context . page . emit ( "dialog" , {
12271233 type : ( ) => "alert" ,
12281234 message : ( ) => "" ,
12291235 defaultValue : ( ) => "" ,
12301236 } ) ;
12311237 yield * Effect . promise ( resized ) ;
12321238 expect ( yield * Queue . size ( reads ) ) . toBe ( 0 ) ;
1233- // Closing it resizes nothing, so the close itself remeasures.
12341239 desktopSizeAnswer = null ;
12351240 yield * Effect . promise ( ( ) => cdp . emitAsync ( "Page.javascriptDialogClosed" ) ) ;
1236- expect ( viewportSizes ( yield * Queue . takeAll ( viewer . output ) ) ) . toEqual ( [ "1920x1080" ] ) ;
1241+ expect ( viewportSizes ( yield * Queue . takeAll ( viewer . output ) ) ) . toEqual ( [
1242+ "1920x1080" ,
1243+ "1920x1080" ,
1244+ ] ) ;
12371245 // The late answer, a read a navigation breaks and a hidden webview keep the last size.
12381246 blocked . resolve ( answer ( 100 , 100 ) ) ;
12391247 deferReads ( ) ;
0 commit comments