File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
packages/react-scripts/fixtures/kitchensink/template/src/features/webpack Expand file tree Collapse file tree 1 file changed +4
-9
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
- import { flushSync } from 'react-dom' ;
12
11
13
12
describe ( 'svg component' , ( ) => {
14
13
it ( 'renders without crashing' , async ( ) => {
15
14
const div = document . createElement ( 'div' ) ;
16
- flushSync ( ( ) => {
17
- ReactDOMClient . createRoot ( div ) . render ( < SvgComponent /> ) ;
18
- } ) ;
15
+ ReactDOMClient . createRoot ( div ) . render ( < SvgComponent /> ) ;
19
16
expect ( div . textContent ) . toBe ( 'logo.svg' ) ;
20
17
} ) ;
21
18
22
19
it ( 'svg root element equals the passed ref' , async ( ) => {
23
20
const div = document . createElement ( 'div' ) ;
24
21
const someRef = React . createRef ( ) ;
25
- flushSync ( ( ) => {
26
- ReactDOMClient . createRoot ( div ) . render (
27
- < SvgComponentWithRef ref = { someRef } />
28
- ) ;
29
- } ) ;
22
+ ReactDOMClient . createRoot ( div ) . render (
23
+ < SvgComponentWithRef ref = { someRef } />
24
+ ) ;
30
25
const svgElement = div . getElementsByTagName ( 'svg' ) ;
31
26
expect ( svgElement ) . toHaveLength ( 1 ) ;
32
27
expect ( svgElement [ 0 ] ) . toBe ( someRef . current ) ;
You can’t perform that action at this time.
0 commit comments