@@ -1256,7 +1256,7 @@ test('MDX (JSX)', async () => {
12561256 renderToStaticMarkup (
12571257 React . createElement ( await run ( compileSync ( '<a>b</a>\t<b>c</b>' ) ) )
12581258 ) ,
1259- '<a>b</a>\n\t\n <b>c</b>' ,
1259+ '<a>b</a>\n<b>c</b>' ,
12601260 'should unravel JSX (text) and whitespace as only children'
12611261 )
12621262
@@ -1363,6 +1363,46 @@ test('MDX (JSX)', async () => {
13631363 '<i>the sum of one and one is: 2</i>' ,
13641364 'should support JSX in expressions'
13651365 )
1366+
1367+ // Important: there should not be whitespace in the `tr`.
1368+ // This is normally not present, but unraveling makes this a bit more complex.
1369+ // See: <https://github.com/mdx-js/mdx/issues/2000>.
1370+ assert . equal (
1371+ compileSync ( `<table>
1372+ <thead>
1373+ <tr>
1374+ <th>a</th>
1375+ <th>b</th>
1376+ </tr>
1377+ </thead>
1378+ </table>` ) . value ,
1379+ [
1380+ '/*@jsxRuntime automatic @jsxImportSource react*/' ,
1381+ 'import {jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";' ,
1382+ 'function _createMdxContent(props) {' ,
1383+ ' return _jsx("table", {' ,
1384+ ' children: _jsx("thead", {' ,
1385+ ' children: _jsxs("tr", {' ,
1386+ ' children: [_jsx("th", {' ,
1387+ ' children: "a"' ,
1388+ ' }), _jsx("th", {' ,
1389+ ' children: "b"' ,
1390+ ' })]' ,
1391+ ' })' ,
1392+ ' })' ,
1393+ ' });' ,
1394+ '}' ,
1395+ 'function MDXContent(props = {}) {' ,
1396+ ' const {wrapper: MDXLayout} = props.components || ({});' ,
1397+ ' return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {' ,
1398+ ' children: _jsx(_createMdxContent, props)' ,
1399+ ' })) : _createMdxContent(props);' ,
1400+ '}' ,
1401+ 'export default MDXContent;' ,
1402+ ''
1403+ ] . join ( '\n' ) ,
1404+ 'should support JSX in expressions'
1405+ )
13661406} )
13671407
13681408test ( 'MDX (ESM)' , async ( ) => {
0 commit comments