-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#5284 - Show a friendly error when using TestUtils.Simulate with shallow rendering #5358
#5284 - Show a friendly error when using TestUtils.Simulate with shallow rendering #5358
Conversation
661c046
to
4a30d74
Compare
@conorhastings updated the pull request. |
@@ -470,6 +470,11 @@ ReactShallowRenderer.prototype._render = function(element, transaction, context) | |||
function makeSimulator(eventType) { | |||
return function(domComponentOrNode, eventData) { | |||
var node; | |||
invariant( | |||
!React.isValidElement(domComponentOrNode), | |||
'TestUtils.Simulate expects a component instance and not a React Element.' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can you write "ReactElement" without a space? That's consistent with our prop types message.
Looks great, just a couple nits – if you could fix those and squash your commits that would be perfect! |
07f4538
to
bbecb01
Compare
@conorhastings updated the pull request. |
@spicyj thanks for the feedback! updated. |
bbecb01
to
fbb8d2f
Compare
@conorhastings updated the pull request. |
…ate-shallow-render #5284 - Show a friendly error when using TestUtils.Simulate with shallow rendering
Looks great! Thank you. |
closes #5284