@@ -11,15 +11,22 @@ describe("CountdownOverlay", () => {
1111 let pushMarquee : MarqueeListener = ( ) => undefined ;
1212 let frames : FrameRequestCallback [ ] = [ ] ;
1313 let textAtFrameRequest : string [ ] = [ ] ;
14+ let ringAtFrameRequest : boolean [ ] = [ ] ;
1415 let notifyCleared : ReturnType < typeof vi . fn > ;
1516 let container : HTMLElement ;
1617
1718 beforeEach ( ( ) => {
1819 frames = [ ] ;
1920 textAtFrameRequest = [ ] ;
21+ ringAtFrameRequest = [ ] ;
2022 notifyCleared = vi . fn ( ) ;
2123 vi . stubGlobal ( "requestAnimationFrame" , ( callback : FrameRequestCallback ) => {
2224 textAtFrameRequest . push ( container ?. textContent ?? "" ) ;
25+ // An active marquee ring has empty text too, so textContent alone cannot
26+ // tell a cleared frame from one that still paints the ring. Capture the
27+ // ring's presence inside the frame-request mock, before any act() can
28+ // flush a deferred setMarquee(false) into the DOM.
29+ ringAtFrameRequest . push ( Boolean ( container ?. querySelector ( ".recording-marquee-ring" ) ) ) ;
2330 frames . push ( callback ) ;
2431 return frames . length ;
2532 } ) ;
@@ -109,6 +116,10 @@ describe("CountdownOverlay", () => {
109116 // still painted the ring would let the hide carry it into the take on Linux.
110117 expect ( container . querySelector ( ".recording-marquee-ring" ) ) . toBeNull ( ) ;
111118 expect ( textAtFrameRequest [ 0 ] ) . toBe ( "" ) ;
119+ // Assert against what the frame-request mock captured, not just the post-act
120+ // DOM: a setMarquee(false) deferred out of flushSync could land before the
121+ // post-act check while leaving this first frame with the ring still painted.
122+ expect ( ringAtFrameRequest [ 0 ] ) . toBe ( false ) ;
112123 for ( let frame = 1 ; frame < CLEARED_AFTER_FRAMES ; frame += 1 ) {
113124 nextFrame ( ) ;
114125 expect ( container . querySelector ( ".recording-marquee-ring" ) ) . toBeNull ( ) ;
0 commit comments