Skip to content

Commit

Permalink
fix(glimmer): preserve empty text attributes (#4897)
Browse files Browse the repository at this point in the history
  • Loading branch information
tchak authored and duailibe committed Aug 1, 2018
1 parent 1915cc3 commit 783923a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/language-handlebars/printer-glimmer.js
Expand Up @@ -174,7 +174,7 @@ function print(path, options, print) {
}
case "AttrNode": {
const isText = n.value.type === "TextNode";
if (isText && n.value.chars === "") {
if (isText && n.value.loc.start.column === n.value.loc.end.column) {
return concat([n.name]);
}
const quote = isText ? '"' : "";
Expand Down
3 changes: 3 additions & 0 deletions tests/html_glimmer/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -151,6 +151,8 @@ exports[`component.hbs - glimmer-verify 1`] = `
<button disabled=disabled class="disabled"></button>
<img alt="" />
<div ...attributes>Hello</div>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<UserGreeting @name="Ricardo" @greeting="Olá" />
Expand All @@ -170,6 +172,7 @@ exports[`component.hbs - glimmer-verify 1`] = `
</button>
<button disabled class="disabled"></button>
<button disabled="disabled" class="disabled"></button>
<img alt="" />
<div ...attributes>
Hello
</div>
Expand Down
2 changes: 2 additions & 0 deletions tests/html_glimmer/component.hbs
Expand Up @@ -14,4 +14,6 @@

<button disabled=disabled class="disabled"></button>

<img alt="" />

<div ...attributes>Hello</div>

0 comments on commit 783923a

Please sign in to comment.