File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
packages/react-scripts/fixtures/kitchensink/template/src/features/webpack Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 8
8
import * as React from 'react' ;
9
9
import SvgComponent , { SvgComponentWithRef } from './SvgComponent' ;
10
10
import ReactDOMClient from 'react-dom/client' ;
11
-
12
- global . IS_REACT_ACT_ENVIRONMENT = true ;
11
+ import { flushSync } from 'react-dom' ;
13
12
14
13
describe ( 'svg component' , ( ) => {
15
- it ( 'renders without crashing' , ( ) => {
14
+ it ( 'renders without crashing' , async ( ) => {
16
15
const div = document . createElement ( 'div' ) ;
17
- ReactDOMClient . createRoot ( div ) . render ( < SvgComponent /> ) ;
16
+ flushSync ( ( ) => {
17
+ ReactDOMClient . createRoot ( div ) . render ( < SvgComponent /> ) ;
18
+ } ) ;
18
19
expect ( div . textContent ) . toBe ( 'logo.svg' ) ;
19
20
} ) ;
20
21
21
22
it ( 'svg root element equals the passed ref' , async ( ) => {
22
23
const div = document . createElement ( 'div' ) ;
23
24
const someRef = React . createRef ( ) ;
24
- // eslint-disable-next-line testing-library/no-unnecessary-act
25
- await React . act ( async ( ) => {
25
+ flushSync ( ( ) => {
26
26
ReactDOMClient . createRoot ( div ) . render (
27
27
< SvgComponentWithRef ref = { someRef } />
28
28
) ;
You can’t perform that action at this time.
0 commit comments