[JSX] Don't wrap JSX Elements in parentheses if they are inside JSX Expression Containers (#845)

master
Alex Rattray 2017-03-01 12:05:57 -08:00 committed by Christopher Chedeau
parent 198a9e4e49
commit 475208d22a
3 changed files with 23 additions and 2 deletions

View File

@ -2677,6 +2677,7 @@ function maybeWrapJSXElementInParens(path, elem, options) {
const NO_WRAP_PARENTS = {
JSXElement: true,
JSXExpressionContainer: true,
ExpressionStatement: true,
CallExpression: true,
ConditionalExpression: true,

View File

@ -60,7 +60,13 @@ exports[`expression.js 1`] = `
this.props.veryBigItemImageViewFunc(option)}
heading={this.props.displayTextFunc(option)}
value={option}
/>
/>;
<ParentComponent prop={
<Child>
test
</Child>
}/>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<View
style={{
@ -122,6 +128,14 @@ exports[`expression.js 1`] = `
heading={this.props.displayTextFunc(option)}
value={option}
/>;
<ParentComponent
prop={
<Child>
test
</Child>
}
/>;
"
`;

View File

@ -57,4 +57,10 @@
this.props.veryBigItemImageViewFunc(option)}
heading={this.props.displayTextFunc(option)}
value={option}
/>
/>;
<ParentComponent prop={
<Child>
test
</Child>
}/>;