diff --git a/src/printer.js b/src/printer.js index 2651414fe..b48ff6178 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1631,7 +1631,15 @@ function genericPrintNoParens(path, options, print, args) { parts.push(": ", path.call(print, "typeAnnotation")); } if (n.value) { - parts.push(" = ", path.call(print, "value")); + parts.push( + " =", + printAssignmentRight( + n.value, + path.call(print, "value"), + false, // canBreak + options + ) + ); } parts.push(semi); diff --git a/tests/class_comment/__snapshots__/jsfmt.spec.js.snap b/tests/class_comment/__snapshots__/jsfmt.spec.js.snap index d3f57b761..e1965e6dd 100644 --- a/tests/class_comment/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_comment/__snapshots__/jsfmt.spec.js.snap @@ -33,6 +33,14 @@ class x { // do nothing } } + +class X { + TEMPLATE = + // tab index is needed so we can focus, which is needed for keyboard events + '
' + + '
' + + '
'; +} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // comment 1 // comment 2 @@ -69,4 +77,12 @@ class x { } } +class X { + TEMPLATE = + // tab index is needed so we can focus, which is needed for keyboard events + '
' + + '
' + + "
"; +} + `; diff --git a/tests/class_comment/comments.js b/tests/class_comment/comments.js index dbe3f0f2e..659a3f4a7 100644 --- a/tests/class_comment/comments.js +++ b/tests/class_comment/comments.js @@ -30,3 +30,11 @@ class x { // do nothing } } + +class X { + TEMPLATE = + // tab index is needed so we can focus, which is needed for keyboard events + '
' + + '
' + + '
'; +}