diff options
Diffstat (limited to 'integration/snippets')
-rw-r--r-- | integration/snippets/jsx-spacing.jsx | 60 |
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); } |