File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
packages/testing/test-utils/src Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ import { Backend, DragDropManager } from 'dnd-core'
6
6
import { act } from 'react-dom/test-utils'
7
7
8
8
interface RefType {
9
- getManager : ( ) => DragDropManager | undefined
9
+ getManager : ( ) => DragDropManager | undefined ,
10
+ getDecoratedComponent < T > ( ) : T
10
11
}
11
12
12
13
/**
@@ -19,9 +20,11 @@ export function wrapInTestContext(
19
20
) : any {
20
21
const forwardedRefFunc = ( props : any , ref : React . Ref < RefType > ) => {
21
22
const dragDropManager = React . useRef < any > ( undefined )
23
+ const decoratedComponentRef = React . useRef < any > ( undefined )
22
24
23
25
React . useImperativeHandle ( ref , ( ) => ( {
24
26
getManager : ( ) => dragDropManager . current ,
27
+ getDecoratedComponent : ( ) => decoratedComponentRef . current
25
28
} ) )
26
29
27
30
return (
@@ -32,7 +35,7 @@ export function wrapInTestContext(
32
35
return null
33
36
} }
34
37
</ DndContext . Consumer >
35
- < DecoratedComponent { ...props } />
38
+ < DecoratedComponent ref = { decoratedComponentRef } { ...props } />
36
39
</ DndProvider >
37
40
)
38
41
}
You can’t perform that action at this time.
0 commit comments