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

Support more component return types #221

Merged
merged 5 commits into from
Nov 23, 2022
Merged

Conversation

andrewiggins
Copy link
Member

@andrewiggins andrewiggins commented Nov 13, 2022

Support more kinds of return types from components, using Preact's ComponentChild type as a guide.

Also fixes a bug where ref and key weren't restored on props in nodeToElement.

@andrewiggins andrewiggins force-pushed the support-more-return-types branch 2 times, most recently from cc4f31f to 552e4e2 Compare November 14, 2022 22:57
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andre,

I had a quick look over this and had a couple of questions and suggestions.

index.d.ts Outdated Show resolved Hide resolved
test/Adapter_test.tsx Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
Copy link
Member Author

@andrewiggins andrewiggins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! <3 Let me know if you have any additional thoughts

index.d.ts Outdated Show resolved Hide resolved
test/Adapter_test.tsx Show resolved Hide resolved
@andrewiggins andrewiggins marked this pull request as draft November 16, 2022 22:47
@andrewiggins
Copy link
Member Author

Looking into this more I think the behavior I have here doesn't quite match React's enzyme adapter so gonna investigate a bit more and add some tests to assert this behavior

@andrewiggins andrewiggins marked this pull request as ready for review November 16, 2022 23:09
@andrewiggins
Copy link
Member Author

Okay, I think this change to nodeToElement is the correct non-breaking change for us. Technically, enzyme converts all non VNodes to null so if that level of compatibility is needed I'll change that behavior behind a flag.

Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the updated tests.

test/integration_test.tsx Show resolved Hide resolved
@andrewiggins andrewiggins merged commit 84877d8 into master Nov 23, 2022
@andrewiggins andrewiggins deleted the support-more-return-types branch November 23, 2022 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants