Skip to content

Commit

Permalink
failing test where mount requires .update
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbay committed Aug 13, 2017
1 parent 3db226c commit c14e87b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/ReactWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3567,4 +3567,33 @@ describeWithDOM('mount', () => {
});
});
});

describe('out-of-band state updates', () => {
class Child extends React.Component {
render() {
return <span />;
}
}

class Test extends React.Component {
callbackSetState() {
this.setState({ showSpan: true });
}

render() {
return (
<div>
{this.state && this.state.showSpan && <span className="show-me" />}
<Child callback={() => this.callbackSetState()} />
</div>
);
}
}

it('should have updated output after child prop callback invokes setState', () => {
const wrapper = mount(<Test />);
wrapper.find(Child).props().callback();
expect(wrapper.find('.show-me').length).to.equal(1);
});
});
});

0 comments on commit c14e87b

Please sign in to comment.