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

Add test for rendering a component with text nodes #652

Merged
merged 2 commits into from
May 21, 2017
Merged

Add test for rendering a component with text nodes #652

merged 2 commits into from
May 21, 2017

Conversation

braddunbar
Copy link
Contributor

@braddunbar braddunbar commented Apr 19, 2017

The implementation of h suggests that textual children of components should not be merged. However, there is no test coverage of this behavior. So I added some!

Is that actually the case? And if so, why are text nodes of components not merged?

The implementation of `h` suggests that textual children of components
should not be merged. However, there is no test coverage of this
behavior.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling e53e306 on braddunbar:h-component-test into e5c7f1d on developit:master.

@developit
Copy link
Member

developit commented Apr 19, 2017

This changed in 8. I'm actually wondering if we could bring back at least some of the behavior (assuming perf & size don't bloat as a result), since your other issue (foo {0} -> ["foo ", 0]) is kinda awkward to work around.

I think we need to gather some input, and maybe check what React does in this case. I looked into this a while back and I believe they just pass children through without any normalization, which is why I made that switch in 8.

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. Although there is debate about the desired behaviour, documenting what is currently expected via a test is a good thing.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 02f98c5 on braddunbar:h-component-test into 5d6a2c4 on developit:master.

@robertknight robertknight merged commit 465dacb into preactjs:master May 21, 2017
@developit
Copy link
Member

👍👍

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.

None yet

4 participants