Skip to content

Commit

Permalink
Fix empty elements
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Aug 25, 2020
1 parent 7e6d776 commit f976c33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/language-html/printer-html.js
Expand Up @@ -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),
]);
Expand Down
14 changes: 4 additions & 10 deletions tests/vue/multiparser/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -110,9 +110,7 @@ printWidth: 80
=====================================input======================================
<custom lang="markdown"></custom>
=====================================output=====================================
<custom lang="markdown">
</custom>
<custom lang="markdown"></custom>
================================================================================
`;
Expand All @@ -127,14 +125,12 @@ printWidth: 80
</custom>
=====================================output=====================================
<custom lang="markdown">
</custom>
<custom lang="markdown"></custom>
================================================================================
`;
exports[`snippet: new line format 2`] = `
exports[`snippet: non-space format 1`] = `
====================================options=====================================
parsers: ["vue"]
printWidth: 80
Expand All @@ -159,9 +155,7 @@ printWidth: 80
=====================================input======================================
<custom lang="markdown"> </custom>
=====================================output=====================================
<custom lang="markdown">
</custom>
<custom lang="markdown"></custom>
================================================================================
`;
Expand Down
2 changes: 1 addition & 1 deletion tests/vue/multiparser/jsfmt.spec.js
Expand Up @@ -12,7 +12,7 @@ run_spec({dirname: __dirname, snippets: [
code: '<custom lang="markdown">\n \n</custom>'
},
{
name: "new line",
name: "non-space",
code: '<custom lang="markdown">\n \u2005 \n</custom>'
},
]}, ["vue"]);

0 comments on commit f976c33

Please sign in to comment.