@@ -9,8 +9,15 @@ import {
9
9
waitForElement ,
10
10
} from '../..' ;
11
11
12
+ interface HasRequiredProp {
13
+ requiredProp : string ;
14
+ }
15
+
12
16
const View = props => props . children ;
13
17
const Text = props => props . children ;
18
+ const ElementWithRequiredProps = ( props : HasRequiredProp ) => (
19
+ < Text > { props . requiredProp } </ Text >
20
+ ) ;
14
21
15
22
const TestComponent = ( ) => (
16
23
< View >
@@ -24,6 +31,9 @@ const tree = render(<TestComponent />);
24
31
const getByNameString : ReactTestInstance = tree . getByName ( 'View' ) ;
25
32
const getByNameContructor : ReactTestInstance = tree . getByName ( View ) ;
26
33
const getByType : ReactTestInstance = tree . getByType ( View ) ;
34
+ const getByTypeWithRequiredProps : ReactTestInstance = tree . getByType (
35
+ ElementWithRequiredProps
36
+ ) ;
27
37
const getByTextString : ReactTestInstance = tree . getByText ( '<View />' ) ;
28
38
const getByTextRegExp : ReactTestInstance = tree . getByText ( / V i e w / g) ;
29
39
const getByProps : ReactTestInstance = tree . getByProps ( { value : 2 } ) ;
@@ -33,6 +43,9 @@ const getAllByNameConstructor: Array<ReactTestInstance> = tree.getAllByName(
33
43
View
34
44
) ;
35
45
const getAllByType : Array < ReactTestInstance > = tree . getAllByType ( View ) ;
46
+ const getAllByTypeWithRequiredProps : Array <
47
+ ReactTestInstance
48
+ > = tree . getAllByType ( ElementWithRequiredProps ) ;
36
49
const getAllByTextString : Array < ReactTestInstance > = tree . getAllByText (
37
50
'<View />'
38
51
) ;
@@ -45,6 +58,9 @@ const getAllByProps: Array<ReactTestInstance> = tree.getAllByProps({
45
58
const queryByNameString : ReactTestInstance | null = tree . queryByName ( 'View' ) ;
46
59
const queryByNameConstructor : ReactTestInstance | null = tree . queryByName ( View ) ;
47
60
const queryByType : ReactTestInstance | null = tree . queryByType ( View ) ;
61
+ const queryByTypeWithRequiredProps : ReactTestInstance | null = tree . queryByType (
62
+ ElementWithRequiredProps
63
+ ) ;
48
64
const queryByTextString : ReactTestInstance | null = tree . queryByText (
49
65
'<View />'
50
66
) ;
@@ -58,6 +74,9 @@ const queryAllByNameConstructor: Array<ReactTestInstance> = tree.getAllByName(
58
74
View
59
75
) ;
60
76
const queryAllByType : Array < ReactTestInstance > = tree . getAllByType ( View ) ;
77
+ const queryAllByTypeWithRequiredProps : Array <
78
+ ReactTestInstance
79
+ > = tree . getAllByType ( ElementWithRequiredProps ) ;
61
80
const queryAllByTextString : Array < ReactTestInstance > = tree . queryAllByText (
62
81
'View'
63
82
) ;
0 commit comments