fix(glimmer): better formatting of boolean attributes (and also ...attributes) (#4891)
parent
505e08292c
commit
65d65a5c13
|
@ -168,7 +168,11 @@ function print(path, options, print) {
|
|||
);
|
||||
}
|
||||
case "AttrNode": {
|
||||
const quote = n.value.type === "TextNode" ? '"' : "";
|
||||
const isText = n.value.type === "TextNode";
|
||||
if (isText && n.value.chars === "") {
|
||||
return concat([n.name]);
|
||||
}
|
||||
const quote = isText ? '"' : "";
|
||||
return concat([n.name, "=", quote, path.call(print, "value"), quote]);
|
||||
}
|
||||
case "ConcatStatement": {
|
||||
|
|
|
@ -139,6 +139,12 @@ exports[`component.hbs - glimmer-verify 1`] = `
|
|||
{{@greeting}}, {{@name}}!
|
||||
|
||||
<button onclick={{action next}}>Next</button>
|
||||
|
||||
<button disabled class="disabled"></button>
|
||||
|
||||
<button disabled=disabled class="disabled"></button>
|
||||
|
||||
<div ...attributes>Hello</div>
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<user-greeting @name="Ricardo" @greeting="Olá"></user-greeting>
|
||||
{{@greeting}}
|
||||
|
@ -148,6 +154,11 @@ exports[`component.hbs - glimmer-verify 1`] = `
|
|||
<button onclick={{action next}}>
|
||||
Next
|
||||
</button>
|
||||
<button disabled class="disabled"></button>
|
||||
<button disabled="disabled" class="disabled"></button>
|
||||
<div ...attributes>
|
||||
Hello
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`concat-statement.hbs - glimmer-verify 1`] = `
|
||||
|
|
|
@ -2,3 +2,9 @@
|
|||
{{@greeting}}, {{@name}}!
|
||||
|
||||
<button onclick={{action next}}>Next</button>
|
||||
|
||||
<button disabled class="disabled"></button>
|
||||
|
||||
<button disabled=disabled class="disabled"></button>
|
||||
|
||||
<div ...attributes>Hello</div>
|
||||
|
|
Loading…
Reference in New Issue