@@ -6,9 +6,9 @@ import { shallow, render, ShallowWrapper, mount } from 'enzyme';
66import { ITERATOR_SYMBOL , withSetStateAllowed , sym } from 'enzyme/build/Utils' ;
77
88import './_helpers/setupAdapters' ;
9- import { createClass } from './_helpers/react-compat' ;
9+ import { createClass , createContext } from './_helpers/react-compat' ;
1010import { 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' ;
1212
1313// The shallow renderer in react 16 does not yet support batched updates. When it does,
1414// we should be able to go un-skip all of the tests that are skipped with this flag.
@@ -96,6 +96,22 @@ describe('shallow', () => {
9696 expect ( wrapper . context ( 'name' ) ) . to . equal ( context . name ) ;
9797 } ) ;
9898
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+
99115 describeIf ( ! REACT013 , 'stateless function components' , ( ) => {
100116 it ( 'can pass in context' , ( ) => {
101117 const SimpleComponent = ( props , context ) => (
0 commit comments