diff --git a/javascript/packages/formatter/test/html/content-preserving-tags.test.ts b/javascript/packages/formatter/test/html/content-preserving-tags.test.ts index 593f854a9..e532fa6d1 100644 --- a/javascript/packages/formatter/test/html/content-preserving-tags.test.ts +++ b/javascript/packages/formatter/test/html/content-preserving-tags.test.ts @@ -178,6 +178,18 @@ describe("@herb-tools/formatter - content preserving tags", () => { expect(formatter.format(result)).toEqual(result) }) + test("preserves attribute spacing on an element nested inside an ERB block (#2142)", () => { + const source = `
<% if condition %>x<% end %>`
+ const result = formatter.format(source)
+ expect(result).toEqual(`<% if condition %>x<% end %>`)
+ })
+
+ test("preserves spacing between multiple attributes on an element nested inside an ERB block", () => {
+ const source = `<% if condition %>x<% end %>`
+ const result = formatter.format(source)
+ expect(result).toEqual(`<% if condition %>x<% end %>`)
+ })
+
test("preserves textarea with ERB control flow", () => {
const source = dedent`