Don't add () in JSX attributes with elements (#3640)
parent
6260629f18
commit
7d3a30615b
|
@ -4477,6 +4477,7 @@ function maybeWrapJSXElementInParens(path, elem) {
|
||||||
|
|
||||||
const NO_WRAP_PARENTS = {
|
const NO_WRAP_PARENTS = {
|
||||||
ArrayExpression: true,
|
ArrayExpression: true,
|
||||||
|
JSXAttribute: true,
|
||||||
JSXElement: true,
|
JSXElement: true,
|
||||||
JSXExpressionContainer: true,
|
JSXExpressionContainer: true,
|
||||||
JSXFragment: true,
|
JSXFragment: true,
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`attr-element.js 1`] = `
|
||||||
|
<Foo prop=<Bar><Baz /></Bar> />;
|
||||||
|
<Foo prop=<><Bar><Baz /></Bar></> />;
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
<Foo
|
||||||
|
prop=<Bar>
|
||||||
|
<Baz />
|
||||||
|
</Bar>
|
||||||
|
/>;
|
||||||
|
<Foo
|
||||||
|
prop=<>
|
||||||
|
<Bar>
|
||||||
|
<Baz />
|
||||||
|
</Bar>
|
||||||
|
</>
|
||||||
|
/>;
|
||||||
|
|
||||||
|
`;
|
|
@ -0,0 +1,2 @@
|
||||||
|
<Foo prop=<Bar><Baz /></Bar> />;
|
||||||
|
<Foo prop=<><Bar><Baz /></Bar></> />;
|
|
@ -0,0 +1,2 @@
|
||||||
|
// Flow and TypeScript don't support JSX elements as attribute values
|
||||||
|
run_spec(__dirname, ["babylon"]);
|
Loading…
Reference in New Issue