565 jsx parentheses fix (#580)

* Add JSXElement in ShouldPrintSameLine helper function.

* Add tests 🚀.
master
Davy Duperron 2017-02-03 01:25:34 +01:00 committed by Christopher Chedeau
parent 86d1264097
commit 6efad59300
3 changed files with 45 additions and 0 deletions

View File

@ -2624,6 +2624,7 @@ function shouldPrintSameLine(node) {
type === "CallExpression" ||
type === "FunctionExpression" ||
type === "Identifier" ||
type === "JSXElement" ||
type === "Literal" ||
type === "MemberExpression" ||
type === "NewExpression" ||

View File

@ -193,3 +193,34 @@ exports[`test quotes.js 1`] = `
<div id={\"\'\\\"&quot;<>&amp;quot;\"} />;
"
`;
exports[`test object-property.js 1`] = `
"const tabs = [
{
title: \"General Info\",
content: (
<GeneralForm
long-attribute=\"i-need-long-value-here\"
onSave={ onSave }
onCancel={ onCancel }
countries={ countries }
/>
)
}
];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const tabs = [
{
title: \"General Info\",
content: (
<GeneralForm
long-attribute=\"i-need-long-value-here\"
onSave={onSave}
onCancel={onCancel}
countries={countries}
/>
)
}
];
"
`;

View File

@ -0,0 +1,13 @@
const tabs = [
{
title: "General Info",
content: (
<GeneralForm
long-attribute="i-need-long-value-here"
onSave={ onSave }
onCancel={ onCancel }
countries={ countries }
/>
)
}
];