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 authored and Alec Robins committed Oct 7, 2016
1 parent 09e3068 commit 7ec03a0
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 7ec03a0

Please sign in to comment.