@@ -480,6 +480,25 @@ test('integration (babel)', function (t) {
480
480
'should format a root'
481
481
)
482
482
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
+
483
502
t . deepEqual (
484
503
generate ( toBabel ( toEstree ( s ( 'svg' , { viewBox : '0 0 1 1' } ) ) ) ) . code ,
485
504
'<svg viewBox="0 0 1 1" />;' ,
@@ -584,7 +603,7 @@ test('integration (micromark-extension-mdxjs, mdast-util-mdx)', function (t) {
584
603
transform (
585
604
'import x from "y"\nexport const name = "World"\n\n## Hello, {name}!'
586
605
) ,
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></>;' ,
588
607
'should transform MDX.js ESM'
589
608
)
590
609
@@ -599,7 +618,7 @@ test('integration (micromark-extension-mdxjs, mdast-util-mdx)', function (t) {
599
618
'import x from "y"\nexport const name = "World"\n\n## Hello, {name}!' ,
600
619
true
601
620
) ,
602
- '<>{"\\n"} <h2>{"Hello, "}{}{"!"}</h2></>;' ,
621
+ '<><h2>{"Hello, "}{}{"!"}</h2></>;' ,
603
622
'should transform ESM w/o estrees'
604
623
)
605
624
@@ -697,7 +716,7 @@ test('integration (@babel/plugin-transform-react-jsx, react)', function (t) {
697
716
'export const name = "World";' ,
698
717
'' ,
699
718
'/*#__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, "!"));'
701
720
] . join ( '\n' ) ,
702
721
'should integrate w/ `@babel/plugin-transform-react-jsx` (MDX.js ESM)'
703
722
)
@@ -800,7 +819,7 @@ test('integration (@vue/babel-plugin-jsx, Vue 3)', function (t) {
800
819
'import x from "y";' ,
801
820
'export const name = "World";' ,
802
821
'' ,
803
- '_createVNode(_Fragment, null, ["\\n", _createVNode("h2", null, ["Hello, ", name, "!"])]);'
822
+ '_createVNode(_Fragment, null, [_createVNode("h2", null, ["Hello, ", name, "!"])]);'
804
823
] . join ( '\n' ) ,
805
824
'should integrate w/ `@vue/babel-plugin-jsx` (MDX.js ESM)'
806
825
)
0 commit comments