@@ -1256,7 +1256,7 @@ test('MDX (JSX)', async () => {
1256
1256
renderToStaticMarkup (
1257
1257
React . createElement ( await run ( compileSync ( '<a>b</a>\t<b>c</b>' ) ) )
1258
1258
) ,
1259
- '<a>b</a>\n\t\n <b>c</b>' ,
1259
+ '<a>b</a>\n<b>c</b>' ,
1260
1260
'should unravel JSX (text) and whitespace as only children'
1261
1261
)
1262
1262
@@ -1363,6 +1363,46 @@ test('MDX (JSX)', async () => {
1363
1363
'<i>the sum of one and one is: 2</i>' ,
1364
1364
'should support JSX in expressions'
1365
1365
)
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
+ )
1366
1406
} )
1367
1407
1368
1408
test ( 'MDX (ESM)' , async ( ) => {
1 commit comments
vercel[bot] commentedon Feb 9, 2023
Successfully deployed to the following URLs:
mdx – ./
mdx-mdx.vercel.app
mdxjs.com
mdx-git-main-mdx.vercel.app
v2.mdxjs.com