diff --git a/src/language-handlebars/utils.js b/src/language-handlebars/utils.js index 07e4c57544f6..aef7f46f813f 100644 --- a/src/language-handlebars/utils.js +++ b/src/language-handlebars/utils.js @@ -41,6 +41,7 @@ const voidTags = new Set(htmlVoidElements); function isVoid(node) { return ( voidTags.has(node.tag) || + node.selfClosing === true || (isGlimmerComponent(node) && node.children.every((node) => isWhitespaceNode(node))) ); diff --git a/tests/format/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap b/tests/format/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap index 7d36706bc63a..9a5e46fd7d6a 100644 --- a/tests/format/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/handlebars/element-node/__snapshots__/jsfmt.spec.js.snap @@ -45,6 +45,11 @@ printWidth: 80 +
+ + + + =====================================output=====================================
Hello @@ -91,5 +96,10 @@ printWidth: 80 @prop4={{true}} as |thing| /> + +
+ + + ================================================================================ `; diff --git a/tests/format/handlebars/element-node/element-node.hbs b/tests/format/handlebars/element-node/element-node.hbs index 0c12a8da0aad..ef13b21e5138 100644 --- a/tests/format/handlebars/element-node/element-node.hbs +++ b/tests/format/handlebars/element-node/element-node.hbs @@ -36,3 +36,8 @@ + +
+ + + diff --git a/tests/format/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap b/tests/format/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap index 33cc64a9404a..73daa2ee6685 100644 --- a/tests/format/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/handlebars/html-whitespace-sensitivity/__snapshots__/jsfmt.spec.js.snap @@ -702,7 +702,7 @@ printWidth: 40 =====================================input======================================   |   =====================================output===================================== -   |   +   |   ================================================================================ `; diff --git a/tests/format/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap b/tests/format/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap index 4229856d7e11..a26517e85ba6 100644 --- a/tests/format/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/handlebars/single-quote-option/__snapshots__/jsfmt.spec.js.snap @@ -99,8 +99,8 @@ singleQuote: false
-
-
+
+
@@ -126,7 +126,7 @@ singleQuote: false class="padding {{if foo (if fooAgain 'bar' (if fooAgainAgain 'bar' 'foo'))}} baz" ->
+/> ================================================================================ `; @@ -161,8 +161,8 @@ singleQuote: true
-
-
+
+
@@ -188,7 +188,7 @@ singleQuote: true class='padding {{if foo (if fooAgain "bar" (if fooAgainAgain "bar" "foo"))}} baz' ->
+/> ================================================================================ `;