Skip to content
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

Conversation

conorhastings
Copy link

closes #5284

@facebook-github-bot
Copy link

@conorhastings updated the pull request.

@conorhastings conorhastings changed the title Show a friendly error when using TestUtils.Simulate with shallow rendering #5284 - Show a friendly error when using TestUtils.Simulate with shallow rendering Nov 2, 2015
@@ -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.' +
Copy link
Collaborator

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.

@sophiebits
Copy link
Collaborator

Looks great, just a couple nits – if you could fix those and squash your commits that would be perfect!

@conorhastings conorhastings force-pushed the invariant-testutils-simulate-shallow-render branch 2 times, most recently from 07f4538 to bbecb01 Compare November 3, 2015 01:11
@facebook-github-bot
Copy link

@conorhastings updated the pull request.

@conorhastings
Copy link
Author

@spicyj thanks for the feedback! updated.

@conorhastings conorhastings force-pushed the invariant-testutils-simulate-shallow-render branch from bbecb01 to fbb8d2f Compare November 3, 2015 01:14
@facebook-github-bot
Copy link

@conorhastings updated the pull request.

sophiebits added a commit that referenced this pull request Nov 3, 2015
…ate-shallow-render

#5284 - Show a friendly error when using TestUtils.Simulate with shallow rendering
@sophiebits sophiebits merged commit 5724fca into facebook:master Nov 3, 2015
@sophiebits
Copy link
Collaborator

Looks great! Thank you.

@conorhastings conorhastings deleted the invariant-testutils-simulate-shallow-render branch November 3, 2015 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show a friendly error when using TestUtils.Simulate with shallow rendering
3 participants