55import assert from 'node:assert/strict'
66import { test } from 'node:test'
77import { evaluate } from '@mdx-js/mdx'
8- import { MDXProvider , useMDXComponents , withMDXComponents } from '@mdx-js/react'
8+ import { MDXProvider , useMDXComponents } from '@mdx-js/react'
99import React from 'react'
1010import * as runtime_ from 'react/jsx-runtime'
1111import { renderToString } from 'react-dom/server'
@@ -17,10 +17,8 @@ const runtime = /** @type {RuntimeProduction} */ (
1717test ( '@mdx-js/react' , async function ( t ) {
1818 await t . test ( 'should expose the public api' , async function ( ) {
1919 assert . deepEqual ( Object . keys ( await import ( '@mdx-js/preact' ) ) . sort ( ) , [
20- 'MDXContext' ,
2120 'MDXProvider' ,
22- 'useMDXComponents' ,
23- 'withMDXComponents'
21+ 'useMDXComponents'
2422 ] )
2523 } )
2624
@@ -207,45 +205,4 @@ test('@mdx-js/react', async function (t) {
207205 )
208206 }
209207 )
210-
211- await t . test ( 'should support `withComponents`' , async function ( ) {
212- const { default : Content } = await evaluate ( '# hi\n## hello' , {
213- ...runtime ,
214- useMDXComponents
215- } )
216-
217- // Unknown props.
218- // type-coverage:ignore-next-line
219- const With = withMDXComponents ( function ( props ) {
220- // Unknown props.
221- // type-coverage:ignore-next-line
222- return props . children
223- } )
224-
225- // Bug: this should use the `h2` component too, logically?
226- // As `withMDXComponents` is deprecated, and it would probably be a breaking
227- // change, we can just remove it later.
228- assert . equal (
229- renderToString (
230- < MDXProvider
231- components = { {
232- h1 ( props ) {
233- return < h1 style = { { color : 'tomato' } } { ...props } />
234- }
235- } }
236- >
237- < With
238- components = { {
239- h2 ( props ) {
240- return < h2 style = { { color : 'papayawhip' } } { ...props } />
241- }
242- } }
243- >
244- < Content />
245- </ With >
246- </ MDXProvider >
247- ) ,
248- '<h1 style="color:tomato">hi</h1>\n<h2>hello</h2>'
249- )
250- } )
251208} )
0 commit comments