aboutsummaryrefslogtreecommitdiff
path: root/integration/snippets
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-11-04 15:27:29 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-11-04 15:27:29 -0700
commitfd57e2d9a630a2ba0d229419e11f39abd97f88bf (patch)
treee090f0cc333175e3852487bf2e360a44a1ceabfa /integration/snippets
parent303a5ea898cd1df71a00caabd326c74940b379fc (diff)
downloadbun-fd57e2d9a630a2ba0d229419e11f39abd97f88bf.tar.gz
bun-fd57e2d9a630a2ba0d229419e11f39abd97f88bf.tar.zst
bun-fd57e2d9a630a2ba0d229419e11f39abd97f88bf.zip
[JSX] Match esbuild behavior for multiline JSX string literals
Diffstat (limited to '')
-rw-r--r--integration/snippets/jsx-spacing.jsx60
1 files changed, 32 insertions, 28 deletions
diff --git a/integration/snippets/jsx-spacing.jsx b/integration/snippets/jsx-spacing.jsx
index 73e31ebaa..5feab1830 100644
--- a/integration/snippets/jsx-spacing.jsx
+++ b/integration/snippets/jsx-spacing.jsx
@@ -1,36 +1,40 @@
import * as ReactDOM from "react-dom/server";
-const Tester = ({ description }) => {
- console.assert(
- description ===
- "foo\nbar \n\nbaz\n\nthis\ntest\n\nchecks\nnewlines\nare\ngood\nyeah\n\n",
- "Expected description to be 'foo\\nbar \\n\\nbaz\\n\\nthis\\ntest\\n\\nchecks\\nnewlines\\nare\\ngood\\nyeah\\n\\n' but was '" +
- description +
- "'"
+const ReturnDescriptionAsString = ({ description }) => description;
+
+export function test() {
+ const _bun = ReactDOM.renderToString(
+ <ReturnDescriptionAsString
+ description="line1
+line2 trailing space
+
+line4 no trailing space 'single quote' \t\f\v\uF000 `template string`
+
+line6 no trailing space
+line7 trailing newline that ${terminates} the string literal
+"
+ ></ReturnDescriptionAsString>
);
- return description;
-};
+ // convert HTML entities to unicode
+ const el = document.createElement("textarea");
+ el.innerHTML = _bun;
+ const bun = el.value;
-export function test() {
- const foo = ReactDOM.renderToString(
- <Tester
- description="foo
- bar
-
- baz
-
- this
- test
-
- checks
- newlines
- are
- good
- yeah
-
- "
- ></Tester>
+ const esbuild =
+ "line1\nline2 trailing space \n\nline4 no trailing space 'single quote' \\t\\f\\v\\uF000 `template string`\n\nline6 no trailing space\nline7 trailing newline that ${terminates} the string literal\n";
+
+ console.assert(
+ bun === esbuild,
+ `strings did not match: ${JSON.stringify(
+ {
+ received: bun,
+ expected: esbuild,
+ },
+ null,
+ 2
+ )}`
);
+
testDone(import.meta.url);
}