File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export interface RenderOptions<
7070 *
7171 * @see https://testing-library.com/docs/react-testing-library/api/#wrapper
7272 */
73- wrapper ?: React . ComponentType < { children : React . ReactElement } >
73+ wrapper ?: React . JSXElementConstructor < { children : React . ReactElement } >
7474}
7575
7676type Omit < T , K extends keyof T > = Pick < T , Exclude < keyof T , K > >
Original file line number Diff line number Diff line change @@ -115,13 +115,32 @@ export function wrappedRenderB(
115115 ui : React . ReactElement ,
116116 options ?: pure . RenderOptions ,
117117) {
118- const Wrapper : React . FunctionComponent = ( { children} ) => {
118+ const Wrapper : React . FunctionComponent < { children ?: React . ReactNode } > = ( {
119+ children,
120+ } ) => {
119121 return < div > { children } </ div >
120122 }
121123
122124 return pure . render ( ui , { wrapper : Wrapper , ...options } )
123125}
124126
127+ export function wrappedRenderC (
128+ ui : React . ReactElement ,
129+ options ?: pure . RenderOptions ,
130+ ) {
131+ interface AppWrapperProps {
132+ userProviderProps ?: { user : string }
133+ }
134+ const AppWrapperProps : React . FunctionComponent < AppWrapperProps > = ( {
135+ children,
136+ userProviderProps = { user : 'TypeScript' } ,
137+ } ) => {
138+ return < div data-testid = { userProviderProps . user } > { children } </ div >
139+ }
140+
141+ return pure . render ( ui , { wrapper : AppWrapperProps , ...options } )
142+ }
143+
125144/*
126145eslint
127146 testing-library/prefer-explicit-assert: "off",
You can’t perform that action at this time.
0 commit comments