From 1a60d7df9836df2ffc6a7a02ff4f90f3cccf599f Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 15 Nov 2021 15:38:49 -0800 Subject: [JS Printer] Fix bug with template literals --- integration/snippets/template-literal.js | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 integration/snippets/template-literal.js (limited to 'integration/snippets/template-literal.js') diff --git a/integration/snippets/template-literal.js b/integration/snippets/template-literal.js new file mode 100644 index 000000000..b65f1a6b1 --- /dev/null +++ b/integration/snippets/template-literal.js @@ -0,0 +1,37 @@ +const css = (templ) => templ.toString(); + +const fooNoBracesUTF8 = css` + before + /* */ + after +`; + +const fooNoBracesUT16 = css` + before + 🙃 + after +`; +const fooUTF8 = css` + before + ${true} + after + +`; + +const fooUTF16 = css` + before + 🙃 ${true} + after + +`; +export function test() { + for (let foo of [fooNoBracesUT16, fooNoBracesUTF8, fooUTF16, fooUTF8]) { + console.assert( + foo.includes("before"), + `Expected ${foo} to include "before"` + ); + console.assert(foo.includes("after"), `Expected ${foo} to include "after"`); + } + + return testDone(import.meta.url); +} -- cgit v1.2.3