diff --git a/src/language-html/printer-html.js b/src/language-html/printer-html.js index 112b59626f4a..9058c0ecbbf2 100644 --- a/src/language-html/printer-html.js +++ b/src/language-html/printer-html.js @@ -87,9 +87,9 @@ function embed(path, print, textToDoc, options) { return concat([ printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), - hardline, + doc === "" ? "" : hardline, doc, - hardline, + doc === "" ? "" : hardline, printClosingTag(node, options), printClosingTagSuffix(node, options), ]); diff --git a/tests/vue/multiparser/__snapshots__/jsfmt.spec.js.snap b/tests/vue/multiparser/__snapshots__/jsfmt.spec.js.snap index e082e313c5f2..612d6e95db8d 100644 --- a/tests/vue/multiparser/__snapshots__/jsfmt.spec.js.snap +++ b/tests/vue/multiparser/__snapshots__/jsfmt.spec.js.snap @@ -110,9 +110,7 @@ printWidth: 80 =====================================input====================================== =====================================output===================================== - - - + ================================================================================ `; @@ -127,14 +125,12 @@ printWidth: 80 =====================================output===================================== - - - + ================================================================================ `; -exports[`snippet: new line format 2`] = ` +exports[`snippet: non-space format 1`] = ` ====================================options===================================== parsers: ["vue"] printWidth: 80 @@ -159,9 +155,7 @@ printWidth: 80 =====================================input====================================== =====================================output===================================== - - - + ================================================================================ `; diff --git a/tests/vue/multiparser/jsfmt.spec.js b/tests/vue/multiparser/jsfmt.spec.js index 85705b90f4a2..ca3a7b5ccebe 100644 --- a/tests/vue/multiparser/jsfmt.spec.js +++ b/tests/vue/multiparser/jsfmt.spec.js @@ -1,18 +1,24 @@ -run_spec({dirname: __dirname, snippets: [ +run_spec( { - name: "empty", - code: '' + dirname: __dirname, + snippets: [ + { + name: "empty", + code: '', + }, + { + name: "spaces", + code: ' ', + }, + { + name: "new line", + code: '\n \n', + }, + { + name: "non-space", + code: '\n \u2005 \n', + }, + ], }, - { - name: "spaces", - code: ' ' - }, - { - name: "new line", - code: '\n \n' - }, - { - name: "new line", - code: '\n \u2005 \n' - }, -]}, ["vue"]); + ["vue"] +);