Skip to content

Commit

Permalink
Failing test for shallow context propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
tilgovi authored and ljharb committed May 22, 2019
1 parent d94d25d commit 052bc7d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,19 @@ describe('shallow', () => {
expect(consumer.context()).to.eql(expectedContext);
});

it('propagates updates to rendered children', () => {
const wrapper = shallow(<TestComponent />, { context: { baz: 'enzyme' } });
const fooProvider = wrapper.find(FooProvider).dive();
const barProvider = fooProvider.find(BarProvider).dive();
const consumer = barProvider.find(FooBarBazConsumer).dive();

fooProvider.setProps({ value: 'we' });
barProvider.setState({ value: 'maintain' });

const expectedContext = { foo: 'we', bar: 'maintain', baz: 'enzyme' };
expect(consumer.context()).to.eql(expectedContext);
});

it('does nothing if disableLifecycleMethods is true', () => {
const wrapper = shallow(<TestComponent />, {
context: { baz: 'enzyme' },
Expand Down

0 comments on commit 052bc7d

Please sign in to comment.