@@ -6,9 +6,9 @@ import { shallow, render, ShallowWrapper, mount } from 'enzyme';
6
6
import { ITERATOR_SYMBOL , withSetStateAllowed , sym } from 'enzyme/build/Utils' ;
7
7
8
8
import './_helpers/setupAdapters' ;
9
- import { createClass } from './_helpers/react-compat' ;
9
+ import { createClass , createContext } from './_helpers/react-compat' ;
10
10
import { describeIf , itIf , itWithData , generateEmptyRenderData } from './_helpers' ;
11
- import { REACT013 , REACT014 , REACT15 , REACT150_4 , REACT16 , is } from './_helpers/version' ;
11
+ import { REACT013 , REACT014 , REACT15 , REACT150_4 , REACT16 , REACT163 , is } from './_helpers/version' ;
12
12
13
13
// The shallow renderer in react 16 does not yet support batched updates. When it does,
14
14
// we should be able to go un-skip all of the tests that are skipped with this flag.
@@ -96,6 +96,22 @@ describe('shallow', () => {
96
96
expect ( wrapper . context ( 'name' ) ) . to . equal ( context . name ) ;
97
97
} ) ;
98
98
99
+ itIf ( REACT163 , 'should find elements through Context elements' , ( ) => {
100
+ const { Provider, Consumer } = createContext ( '' ) ;
101
+
102
+ class Foo extends React . Component {
103
+ render ( ) {
104
+ return (
105
+ < Consumer > { value => < span > { value } </ span > } </ Consumer >
106
+ ) ;
107
+ }
108
+ }
109
+
110
+ const wrapper = mount ( < Provider value = "foo" > < div > < Foo /> </ div > </ Provider > ) ;
111
+
112
+ expect ( wrapper . find ( 'span' ) . text ( ) ) . to . equal ( 'foo' ) ;
113
+ } ) ;
114
+
99
115
describeIf ( ! REACT013 , 'stateless function components' , ( ) => {
100
116
it ( 'can pass in context' , ( ) => {
101
117
const SimpleComponent = ( props , context ) => (
0 commit comments