This repository was archived by the owner on Jul 30, 2020. It is now read-only.
File tree 3 files changed +27
-16
lines changed 3 files changed +27
-16
lines changed Original file line number Diff line number Diff line change 56
56
"metro-react-native-babel-preset" : " ^0.52.0" ,
57
57
"prettier" : " ^1.16.4" ,
58
58
"pretty-quick" : " ^1.10.0" ,
59
- "react" : " ^ 16.8.5 " ,
59
+ "react" : " 16.8.3 " ,
60
60
"react-hooks-testing-library" : " ^0.5.0" ,
61
61
"react-intl" : " ^2.8.0" ,
62
62
"react-intl-native" : " ^2.1.2" ,
63
- "react-native" : " ^0.59.0 " ,
63
+ "react-native" : " ^0.59.5 " ,
64
64
"react-native-gesture-handler" : " ^1.1.0" ,
65
65
"react-navigation" : " ^3.5.1" ,
66
- "react-redux" : " 6 .0.1 " ,
67
- "redux" : " ^4.0.0 " ,
66
+ "react-redux" : " ^7 .0.3 " ,
67
+ "redux" : " ^4.0.1 " ,
68
68
"semantic-release" : " ^15.13.3"
69
69
},
70
70
"peerDependencies" : {
Original file line number Diff line number Diff line change
1
+ import { queryAllByProp } from '../lib' ;
2
+ import { render } from '../index' ;
3
+ import { Text , View } from 'react-native' ;
4
+ import React from 'react' ;
5
+
6
+ // This is to ensure custom queries can be passed to render. In most cases, you
7
+ // wouldn't/shouldn't need to do this, but we do allow it so we'll test to
8
+ // make sure that it works for those who use it.
9
+ test ( 'returns the queries passed as options bound to the container' , ( ) => {
10
+ const queryAllBySelectionColor = queryAllByProp . bind ( null , 'selectionColor' ) ;
11
+ const queries = { queryAllBySelectionColor } ;
12
+
13
+ const { queryAllBySelectionColor : queryAllByImplementationDetail } = render (
14
+ < View >
15
+ < Text selectionColor = "blue" > hello world</ Text >
16
+ </ View > ,
17
+ { queries } ,
18
+ ) ;
19
+
20
+ expect ( queryAllByImplementationDetail ( 'blue' ) ) . toHaveLength ( 1 ) ;
21
+ } ) ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { View } from 'react-native' ;
3
- import { render } from '../' ;
2
+ import { Text , View } from 'react-native' ;
3
+ import { queryAllByProp , render } from '../' ;
4
4
5
5
test ( 'renders View' , ( ) => {
6
6
const { container } = render ( < View /> ) ;
@@ -30,13 +30,3 @@ test('renders options.wrapper around node', () => {
30
30
</View>
31
31
` ) ;
32
32
} ) ;
33
-
34
- test ( 'returns the queries passed as options bound to the container' , ( ) => {
35
- const _getQueryPassedAsOption = { bind : jest . fn ( ( ) => _getQueryPassedAsOption ) } ;
36
- const queries = { getQueryPassedAsOption : _getQueryPassedAsOption } ;
37
-
38
- const { container, getQueryPassedAsOption } = render ( < View /> , { queries } ) ;
39
-
40
- expect ( queries . getQueryPassedAsOption . bind ) . toHaveBeenCalledWith ( null , container ) ;
41
- expect ( getQueryPassedAsOption ) . toEqual ( _getQueryPassedAsOption ) ;
42
- } ) ;
You can’t perform that action at this time.
0 commit comments