@@ -9,8 +9,15 @@ import {
99 waitForElement ,
1010} from '../..' ;
1111
12+ interface HasRequiredProp {
13+ requiredProp : string ;
14+ }
15+
1216const View = props => props . children ;
1317const Text = props => props . children ;
18+ const ElementWithRequiredProps = ( props : HasRequiredProp ) => (
19+ < Text > { props . requiredProp } </ Text >
20+ ) ;
1421
1522const TestComponent = ( ) => (
1623 < View >
@@ -24,6 +31,9 @@ const tree = render(<TestComponent />);
2431const getByNameString : ReactTestInstance = tree . getByName ( 'View' ) ;
2532const getByNameContructor : ReactTestInstance = tree . getByName ( View ) ;
2633const getByType : ReactTestInstance = tree . getByType ( View ) ;
34+ const getByTypeWithRequiredProps : ReactTestInstance = tree . getByType (
35+ ElementWithRequiredProps
36+ ) ;
2737const getByTextString : ReactTestInstance = tree . getByText ( '<View />' ) ;
2838const getByTextRegExp : ReactTestInstance = tree . getByText ( / V i e w / g) ;
2939const getByProps : ReactTestInstance = tree . getByProps ( { value : 2 } ) ;
@@ -33,6 +43,9 @@ const getAllByNameConstructor: Array<ReactTestInstance> = tree.getAllByName(
3343 View
3444) ;
3545const getAllByType : Array < ReactTestInstance > = tree . getAllByType ( View ) ;
46+ const getAllByTypeWithRequiredProps : Array <
47+ ReactTestInstance
48+ > = tree . getAllByType ( ElementWithRequiredProps ) ;
3649const getAllByTextString : Array < ReactTestInstance > = tree . getAllByText (
3750 '<View />'
3851) ;
@@ -45,6 +58,9 @@ const getAllByProps: Array<ReactTestInstance> = tree.getAllByProps({
4558const queryByNameString : ReactTestInstance | null = tree . queryByName ( 'View' ) ;
4659const queryByNameConstructor : ReactTestInstance | null = tree . queryByName ( View ) ;
4760const queryByType : ReactTestInstance | null = tree . queryByType ( View ) ;
61+ const queryByTypeWithRequiredProps : ReactTestInstance | null = tree . queryByType (
62+ ElementWithRequiredProps
63+ ) ;
4864const queryByTextString : ReactTestInstance | null = tree . queryByText (
4965 '<View />'
5066) ;
@@ -58,6 +74,9 @@ const queryAllByNameConstructor: Array<ReactTestInstance> = tree.getAllByName(
5874 View
5975) ;
6076const queryAllByType : Array < ReactTestInstance > = tree . getAllByType ( View ) ;
77+ const queryAllByTypeWithRequiredProps : Array <
78+ ReactTestInstance
79+ > = tree . getAllByType ( ElementWithRequiredProps ) ;
6180const queryAllByTextString : Array < ReactTestInstance > = tree . queryAllByText (
6281 'View'
6382) ;
0 commit comments