diff --git a/src/printer.js b/src/printer.js index 09e463da..454aaae3 100644 --- a/src/printer.js +++ b/src/printer.js @@ -284,7 +284,8 @@ function genericPrintNoParens(path, options, print) { if ( n.body.type === "ArrayExpression" || n.body.type === "ObjectExpression" || - n.body.type === "JSXElement" + n.body.type === "JSXElement" || + n.body.type === "BlockStatement" ) { return group(collapsed); } diff --git a/tests/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/arrows/__snapshots__/jsfmt.spec.js.snap index b5a44469..2e626000 100644 --- a/tests/arrows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrows/__snapshots__/jsfmt.spec.js.snap @@ -34,3 +34,19 @@ veryLongCall( ); " `; + +exports[`test long-contents.js 1`] = ` +"const foo = () => { + expect(arg1, arg2, arg3).toEqual({message: \'test\', messageType: \'SMS\', status: \'Unknown\', created: \'11/01/2017 13:36\'}); +}; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +const foo = () => { + expect(arg1, arg2, arg3).toEqual({ + message: \"test\", + messageType: \"SMS\", + status: \"Unknown\", + created: \"11/01/2017 13:36\" + }); +}; +" +`; diff --git a/tests/arrows/long-contents.js b/tests/arrows/long-contents.js new file mode 100644 index 00000000..e4d78f58 --- /dev/null +++ b/tests/arrows/long-contents.js @@ -0,0 +1,3 @@ +const foo = () => { + expect(arg1, arg2, arg3).toEqual({message: 'test', messageType: 'SMS', status: 'Unknown', created: '11/01/2017 13:36'}); +};