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