Skip to content

Commit

Permalink
split setContext test between react versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbay committed Mar 15, 2017
1 parent 5dda4f8 commit 765ec95
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sinon from 'sinon';
import { shallow, render, ShallowWrapper } from '../src/';
import { describeIf, itIf, itWithData, generateEmptyRenderData } from './_helpers';
import { ITERATOR_SYMBOL, withSetStateAllowed } from '../src/Utils';
import { REACT013, REACT15 } from '../src/version';
import { REACT013, REACT014, REACT15 } from '../src/version';

describe('shallow', () => {
describe('context', () => {
Expand Down Expand Up @@ -2777,13 +2777,27 @@ describe('shallow', () => {
]);
});

it('calls expected methods when receiving new context', () => {
wrapper.setContext({ foo: 'foo' });
expect(spy.args).to.deep.equal([
['shouldComponentUpdate'],
['componentWillUpdate'],
['render'],
]);
describeIf(REACT013 || REACT15, 'setContext', () => {
it('calls expected methods when receiving new context', () => {
wrapper.setContext({ foo: 'foo' });
expect(spy.args).to.deep.equal([
['componentWillReceiveProps'],
['shouldComponentUpdate'],
['componentWillUpdate'],
['render'],
]);
});
});

describeIf(REACT014, 'setContext', () => {
it('calls expected methods when receiving new context', () => {
wrapper.setContext({ foo: 'foo' });
expect(spy.args).to.deep.equal([
['shouldComponentUpdate'],
['componentWillUpdate'],
['render'],
]);
});
});

it('calls expected methods for setState', () => {
Expand Down

0 comments on commit 765ec95

Please sign in to comment.