Files
test-repo/tests/multiparser_js_html/html-template-literals.js
T
Kagami Sascha RosylightandGeorgii Dolzhykov 1cd90c9fb8 Do not add hard linebreak for html template (#7208)
* Do not add hard linebreak for html template

* Collapse whitespaces to single space char

* restore line breaking

* use `line` and rename vars

* add test

* support htmlWhitespaceSensitivity

* indent if breakable

* add htmlWhitespaceSensitivity test

* indent only when multiple top levels

* add a changelog entry

* update snapshot

* replace match with test

* split tests into multiple files for better readability of snapshots

* fix an edge case with html-in-js-in-html

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-02-03 17:09:38 +02:00

33 lines
575 B
JavaScript

const nestedFun = /* HTML */ `${outerExpr(1)}
<script>
const tpl = html\`<div>\${innerExpr(1)} ${outerExpr(2)}</div>\`;
</script>`;
const nestedFun2 = /* HTML */ `${outerExpr(1)}
<script>
const tpl = html\`\\n<div>\${innerExpr(1)} ${outerExpr(2)}</div>\\n\`;
</script>`;
setFoo(
html`<div>one</div>
<div>two</div>
<div>three</div>`,
secondArgument
);
setFoo(
html`<div>
<div>nested</div>
</div>
<div>two</div>
<div>three</div>`,
secondArgument
);
setFoo(
html`<div>
<div>nested</div>
</div>`,
secondArgument
);