Skip to content

Commit

Permalink
Use batchedUpdates for setProps test
Browse files Browse the repository at this point in the history
  • Loading branch information
alecrobins committed Oct 2, 2016
1 parent 5a2fe98 commit 4ed9c95
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/ReactWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import React from 'react';
import { expect } from 'chai';
import sinon from 'sinon';
import { batchedUpdates } from '../src/react-compat';

import {
describeWithDOM,
Expand Down Expand Up @@ -971,8 +972,12 @@ describeWithDOM('mount', () => {
}
const wrapper = mount(<Foo id="foo" />);
expect(wrapper.find('.foo').length).to.equal(1);
wrapper.setProps({ id: 'bar', foo: 'bla' }, () => {
expect(wrapper.find('.bar').length).to.equal(1);

batchedUpdates(() => {
wrapper.setProps({ id: 'bar', foo: 'bla' }, () => {
expect(wrapper.find('.bar').length).to.equal(1);
});
expect(wrapper.find('.bar').length).to.equal(0);
});
});

Expand Down

0 comments on commit 4ed9c95

Please sign in to comment.