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

Projects
None yet
3 participants
@conorhastings
Copy link
Contributor

commented Nov 2, 2015

closes #5284

@conorhastings conorhastings force-pushed the conorhastings:invariant-testutils-simulate-shallow-render branch from 661c046 to 4a30d74 Nov 2, 2015

@facebook-github-bot

This comment has been minimized.

Copy link

commented Nov 2, 2015

@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.' +

This comment has been minimized.

Copy link
@sophiebits

sophiebits Nov 3, 2015

Collaborator

nit: Can you write "ReactElement" without a space? That's consistent with our prop types message.

invariant(
!React.isValidElement(domComponentOrNode),
'TestUtils.Simulate expects a component instance and not a React Element.' +
'TestUtils.Simulate will not work if you are utilizing shallowRender.'

This comment has been minimized.

Copy link
@sophiebits

sophiebits Nov 3, 2015

Collaborator

nit: Instead of "shallowRender" (which isn't actually spelled like that anywhere) can we just say "if you are using shallow rendering"?

@sophiebits

This comment has been minimized.

Copy link
Collaborator

commented Nov 3, 2015

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

@conorhastings conorhastings force-pushed the conorhastings:invariant-testutils-simulate-shallow-render branch 2 times, most recently from 07f4538 to bbecb01 Nov 3, 2015

@facebook-github-bot

This comment has been minimized.

Copy link

commented Nov 3, 2015

@conorhastings updated the pull request.

@conorhastings

This comment has been minimized.

Copy link
Contributor Author

commented Nov 3, 2015

@spicyj thanks for the feedback! updated.

@conorhastings conorhastings force-pushed the conorhastings:invariant-testutils-simulate-shallow-render branch from bbecb01 to fbb8d2f Nov 3, 2015

@facebook-github-bot

This comment has been minimized.

Copy link

commented Nov 3, 2015

@conorhastings updated the pull request.

sophiebits added a commit that referenced this pull request Nov 3, 2015

Merge pull request #5358 from conorhastings/invariant-testutils-simul…
…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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@sophiebits

This comment has been minimized.

Copy link
Collaborator

commented Nov 3, 2015

Looks great! Thank you.

@conorhastings conorhastings deleted the conorhastings:invariant-testutils-simulate-shallow-render branch Nov 3, 2015

@renovate renovate bot referenced this pull request Feb 2, 2018

Open

Update dependency react to v0.14.9 #29

0 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.