Skip to content

Conversation

brucewpaul
Copy link

before, a string was accepted via react-element-to-jsx-string.
As that is no longer being used in favor of a custom function,
a string should still be accepted.

@brucewpaul
Copy link
Author

this pr address #204

@@ -20,6 +20,8 @@ function reactArrayToJSXString (nodes) {
export default function reactNodeToString (node) {
if (Array.isArray(node)) {
return reactArrayToJSXString(node)
} else if (typeof node !== 'object') {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not so sure about this check; should it maybe just be "if it's a string, return it"?

Copy link
Author

Choose a reason for hiding this comment

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

I think I agree. @lelandrichardson suggested this way, but I think that having it throw when supplied say a number is better and more accurate then coercing it into a string.

Copy link
Member

Choose a reason for hiding this comment

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

Is there a use case for allowing a non-string to work? It seems like that's likely to be a bug more than .to.contain(3) is used for convenience.

before, a string was accepted via react-element-to-jsx-string.
As that is no longer being used in favor of a custom function,
a string should still be accepted.
@ayrton
Copy link
Contributor

ayrton commented Oct 12, 2017

Looks like this breaks when using enzyme 2 (see travis)

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.

3 participants