Skip to content

Commit

Permalink
Add regression test for #353 (#921)
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Moore <[email protected]>
  • Loading branch information
MoustaphaDev and natemoo-re authored Jan 4, 2024
1 parent 83bef19 commit 5658fbd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions internal/printer/printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,23 @@ import type data from "test"
` + BACKTICK + `,})}`,
},
},
{
name: "nested template literal expression",
source: `<html lang="en">
<body>
{Object.keys(importedAuthors).map(author => <p><div>hello</div></p>)}
{Object.keys(importedAuthors).map(author => <p><div>{author}</div></p>)}
</body>
</html>`,
want: want{
code: `<html lang="en">
${$$maybeRenderHead($$result)}<body>
${Object.keys(importedAuthors).map(author => $$render` + BACKTICK + `<p></p><div>hello</div>` + BACKTICK + `)}
${Object.keys(importedAuthors).map(author => $$render` + BACKTICK + `<p></p><div>${author}</div>` + BACKTICK + `)}
</body>
</html>`,
},
},
{
name: "complex nested template literal expression",
source: "<div value={`${attr ? `a/b ${`c ${`d ${cool}`}`}` : \"d\"} ahhhh`} />",
Expand Down

0 comments on commit 5658fbd

Please sign in to comment.