Skip to content

Commit c14e87b

Browse files
committed
failing test where mount requires .update
1 parent 3db226c commit c14e87b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/ReactWrapper-spec.jsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,4 +3567,33 @@ describeWithDOM('mount', () => {
35673567
});
35683568
});
35693569
});
3570+
3571+
describe('out-of-band state updates', () => {
3572+
class Child extends React.Component {
3573+
render() {
3574+
return <span />;
3575+
}
3576+
}
3577+
3578+
class Test extends React.Component {
3579+
callbackSetState() {
3580+
this.setState({ showSpan: true });
3581+
}
3582+
3583+
render() {
3584+
return (
3585+
<div>
3586+
{this.state && this.state.showSpan && <span className="show-me" />}
3587+
<Child callback={() => this.callbackSetState()} />
3588+
</div>
3589+
);
3590+
}
3591+
}
3592+
3593+
it('should have updated output after child prop callback invokes setState', () => {
3594+
const wrapper = mount(<Test />);
3595+
wrapper.find(Child).props().callback();
3596+
expect(wrapper.find('.show-me').length).to.equal(1);
3597+
});
3598+
});
35703599
});

0 commit comments

Comments
 (0)