@@ -480,6 +480,25 @@ test('integration (babel)', function (t) {
480480 'should format a root'
481481 )
482482
483+ t . deepEqual (
484+ generate (
485+ toBabel (
486+ toEstree ( {
487+ type : 'root' ,
488+ children : [
489+ { type : 'text' , value : ' ' } ,
490+ { type : 'text' , value : 'x' } ,
491+ { type : 'text' , value : ' ' } ,
492+ { type : 'text' , value : 'y' } ,
493+ { type : 'text' , value : ' ' }
494+ ]
495+ } )
496+ )
497+ ) . code ,
498+ '<>{"x"}{" "}{"y"}</>;' ,
499+ 'should ignore initial and trailing whitespace in a root'
500+ )
501+
483502 t . deepEqual (
484503 generate ( toBabel ( toEstree ( s ( 'svg' , { viewBox : '0 0 1 1' } ) ) ) ) . code ,
485504 '<svg viewBox="0 0 1 1" />;' ,
@@ -584,7 +603,7 @@ test('integration (micromark-extension-mdxjs, mdast-util-mdx)', function (t) {
584603 transform (
585604 'import x from "y"\nexport const name = "World"\n\n## Hello, {name}!'
586605 ) ,
587- 'import x from "y";\nexport const name = "World";\n<>{"\\n"} <h2>{"Hello, "}{name}{"!"}</h2></>;' ,
606+ 'import x from "y";\nexport const name = "World";\n<><h2>{"Hello, "}{name}{"!"}</h2></>;' ,
588607 'should transform MDX.js ESM'
589608 )
590609
@@ -599,7 +618,7 @@ test('integration (micromark-extension-mdxjs, mdast-util-mdx)', function (t) {
599618 'import x from "y"\nexport const name = "World"\n\n## Hello, {name}!' ,
600619 true
601620 ) ,
602- '<>{"\\n"} <h2>{"Hello, "}{}{"!"}</h2></>;' ,
621+ '<><h2>{"Hello, "}{}{"!"}</h2></>;' ,
603622 'should transform ESM w/o estrees'
604623 )
605624
@@ -697,7 +716,7 @@ test('integration (@babel/plugin-transform-react-jsx, react)', function (t) {
697716 'export const name = "World";' ,
698717 '' ,
699718 '/*#__PURE__*/' ,
700- 'React.createElement(React.Fragment, null, "\\n", /*#__PURE__*/React.createElement("h2", null, "Hello, ", name, "!"));'
719+ 'React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("h2", null, "Hello, ", name, "!"));'
701720 ] . join ( '\n' ) ,
702721 'should integrate w/ `@babel/plugin-transform-react-jsx` (MDX.js ESM)'
703722 )
@@ -800,7 +819,7 @@ test('integration (@vue/babel-plugin-jsx, Vue 3)', function (t) {
800819 'import x from "y";' ,
801820 'export const name = "World";' ,
802821 '' ,
803- '_createVNode(_Fragment, null, ["\\n", _createVNode("h2", null, ["Hello, ", name, "!"])]);'
822+ '_createVNode(_Fragment, null, [_createVNode("h2", null, ["Hello, ", name, "!"])]);'
804823 ] . join ( '\n' ) ,
805824 'should integrate w/ `@vue/babel-plugin-jsx` (MDX.js ESM)'
806825 )
0 commit comments