@@ -14,7 +14,6 @@ import {addWindowFocusTracking, useFocusVisible, useFocusVisibleListener} from '
14
14
import { hasSetupGlobalListeners } from '../src/useFocusVisible' ;
15
15
import { mergeProps } from '@react-aria/utils' ;
16
16
import React from 'react' ;
17
- import { render as ReactDOMRender } from 'react-dom' ;
18
17
import { useButton } from '@react-aria/button' ;
19
18
import { useFocusRing } from '@react-aria/focus' ;
20
19
@@ -120,7 +119,7 @@ describe('useFocusVisible', function () {
120
119
} ) ;
121
120
122
121
it ( 'sets up focus listener in a different window' , async function ( ) {
123
- ReactDOMRender ( < Example id = "iframe-example" /> , iframeRoot ) ;
122
+ render ( < Example id = "iframe-example" /> , { container : iframeRoot } ) ;
124
123
await waitFor ( ( ) => {
125
124
expect ( document . querySelector ( 'iframe' ) . contentWindow . document . body . querySelector ( 'div[id="iframe-example"]' ) ) . toBeTruthy ( ) ;
126
125
} ) ;
@@ -184,7 +183,7 @@ describe('useFocusVisible', function () {
184
183
} ) ;
185
184
186
185
it ( 'removes the window object from the hasSetupGlobalListeners object on beforeunload' , async function ( ) {
187
- ReactDOMRender ( < Example id = "iframe-example" /> , iframeRoot ) ;
186
+ render ( < Example id = "iframe-example" /> , { container : iframeRoot } ) ;
188
187
expect ( hasSetupGlobalListeners . size ) . toBe ( 1 ) ;
189
188
expect ( hasSetupGlobalListeners . get ( window ) ) . toBeTruthy ( ) ;
190
189
expect ( hasSetupGlobalListeners . get ( iframe . contentWindow ) ) . toBeFalsy ( ) ;
@@ -203,7 +202,7 @@ describe('useFocusVisible', function () {
203
202
} ) ;
204
203
205
204
it ( 'removes the window object from the hasSetupGlobalListeners object if we preemptively tear down' , async function ( ) {
206
- ReactDOMRender ( < Example id = "iframe-example" /> , iframeRoot ) ;
205
+ render ( < Example id = "iframe-example" /> , { container : iframeRoot } ) ;
207
206
expect ( hasSetupGlobalListeners . size ) . toBe ( 1 ) ;
208
207
expect ( hasSetupGlobalListeners . get ( window ) ) . toBeTruthy ( ) ;
209
208
expect ( hasSetupGlobalListeners . get ( iframe . contentWindow ) ) . toBeFalsy ( ) ;
@@ -221,7 +220,7 @@ describe('useFocusVisible', function () {
221
220
} ) ;
222
221
223
222
it ( 'returns positive isFocusVisible result after toggling browser tabs after keyboard navigation' , async function ( ) {
224
- ReactDOMRender ( < Example id = "iframe-example" /> , iframeRoot ) ;
223
+ render ( < Example id = "iframe-example" /> , { container : iframeRoot } ) ;
225
224
addWindowFocusTracking ( iframeRoot ) ;
226
225
227
226
// Fire focus in iframe
@@ -241,7 +240,7 @@ describe('useFocusVisible', function () {
241
240
} ) ;
242
241
243
242
it ( 'returns negative isFocusVisible result after toggling browser tabs without prior keyboard navigation' , async function ( ) {
244
- ReactDOMRender ( < Example id = "iframe-example" /> , iframeRoot ) ;
243
+ render ( < Example id = "iframe-example" /> , { container : iframeRoot } ) ;
245
244
addWindowFocusTracking ( iframeRoot ) ;
246
245
247
246
// Fire focus in iframe
@@ -259,7 +258,7 @@ describe('useFocusVisible', function () {
259
258
} ) ;
260
259
261
260
it ( 'returns positive isFocusVisible result after toggling browser window after keyboard navigation' , async function ( ) {
262
- ReactDOMRender ( < Example id = "iframe-example" /> , iframeRoot ) ;
261
+ render ( < Example id = "iframe-example" /> , { container : iframeRoot } ) ;
263
262
addWindowFocusTracking ( iframeRoot ) ;
264
263
265
264
// Fire focus in iframe
@@ -278,7 +277,7 @@ describe('useFocusVisible', function () {
278
277
} ) ;
279
278
280
279
it ( 'returns negative isFocusVisible result after toggling browser window without prior keyboard navigation' , async function ( ) {
281
- ReactDOMRender ( < Example id = "iframe-example" /> , iframeRoot ) ;
280
+ render ( < Example id = "iframe-example" /> , { container : iframeRoot } ) ;
282
281
addWindowFocusTracking ( iframeRoot ) ;
283
282
284
283
// Fire focus in iframe
@@ -297,7 +296,7 @@ describe('useFocusVisible', function () {
297
296
} ) ;
298
297
299
298
it ( 'correctly shifts focus to the iframe when the iframe is focused' , async function ( ) {
300
- ReactDOMRender ( < ButtonExample id = "iframe-example" /> , iframeRoot ) ;
299
+ render ( < ButtonExample id = "iframe-example" /> , { container : iframeRoot } ) ;
301
300
addWindowFocusTracking ( iframeRoot ) ;
302
301
303
302
// Fire focus in iframe
0 commit comments