@@ -31,6 +31,7 @@ describe("PanelResizeHandle", () => {
3131 beforeEach ( ( ) => {
3232 // @ts -expect-error
3333 global . IS_REACT_ACT_ENVIRONMENT = true ;
34+
3435 container = document . createElement ( "div" ) ;
3536 document . body . appendChild ( container ) ;
3637
@@ -259,37 +260,42 @@ describe("PanelResizeHandle", () => {
259260 } ) ;
260261 } ) ;
261262
263+ describe ( "portals and child windows" , ( ) => {
264+ test ( "should add the pointerup event to the separate document NOT the main document" , ( ) => {
265+ act ( ( ) => {
266+ root . unmount ( ) ;
267+ } ) ;
262268
263- describe ( "event handlers when rendered in a separate document" , ( ) => {
264- let separateWindowDocument : Document ;
265- beforeEach ( ( ) => {
266- // @ts -expect-error
267- global . IS_REACT_ACT_ENVIRONMENT = true ;
269+ const separateWindowDocument =
270+ document . implementation . createHTMLDocument ( ) ;
268271
269- separateWindowDocument = document . implementation . createHTMLDocument ( ) ;
270272 container = separateWindowDocument . createElement ( "div" ) ;
273+
271274 separateWindowDocument . body . appendChild ( container ) ;
272- jest . spyOn ( separateWindowDocument . body , "addEventListener" ) ;
273- jest . spyOn ( document . body , "addEventListener" ) ;
275+
276+ vi . spyOn ( separateWindowDocument . body , "addEventListener" ) ;
277+ vi . spyOn ( document . body , "addEventListener" ) ;
278+
274279 expectedWarnings = [ ] ;
280+
275281 root = createRoot ( container ) ;
276- } ) ;
277282
278- it ( "should add the pointerup event to the separate document NOT the main document" , ( ) => {
279283 const { leftElement } = setupMockedGroup ( ) ;
280284
281285 act ( ( ) => {
282286 dispatchPointerEvent ( "pointerdown" , leftElement ) ;
283287 dispatchPointerEvent ( "pointerup" , leftElement ) ;
284288 } ) ;
285289
286- expect ( separateWindowDocument . body . addEventListener ) . toHaveBeenCalledWith ( "pointerup" , expect . anything ( ) , expect . anything ( ) ) ;
290+ expect ( separateWindowDocument . body . addEventListener ) . toHaveBeenCalledWith (
291+ "pointerup" ,
292+ expect . anything ( ) ,
293+ expect . anything ( )
294+ ) ;
287295 expect ( document . body . addEventListener ) . not . toHaveBeenCalled ( ) ;
288-
289296 } ) ;
290297 } ) ;
291298
292-
293299 describe ( "data attributes" , ( ) => {
294300 test ( "should initialize with the correct props based attributes" , ( ) => {
295301 const { leftElement, rightElement } = setupMockedGroup ( ) ;
0 commit comments