7
7
import assert from 'node:assert/strict'
8
8
import { test } from 'node:test'
9
9
import { evaluate } from '@mdx-js/mdx'
10
- import { MDXProvider , useMDXComponents , withMDXComponents } from '@mdx-js/preact'
10
+ import { MDXProvider , useMDXComponents } from '@mdx-js/preact'
11
11
import * as runtime_ from 'preact/jsx-runtime'
12
12
import { render } from 'preact-render-to-string'
13
13
@@ -16,10 +16,8 @@ const runtime = /** @type {RuntimeProduction} */ (runtime_)
16
16
test ( '@mdx-js/preact' , async function ( t ) {
17
17
await t . test ( 'should expose the public api' , async function ( ) {
18
18
assert . deepEqual ( Object . keys ( await import ( '@mdx-js/preact' ) ) . sort ( ) , [
19
- 'MDXContext' ,
20
19
'MDXProvider' ,
21
- 'useMDXComponents' ,
22
- 'withMDXComponents'
20
+ 'useMDXComponents'
23
21
] )
24
22
} )
25
23
@@ -209,44 +207,4 @@ test('@mdx-js/preact', async function (t) {
209
207
)
210
208
}
211
209
)
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
- } )
252
210
} )
0 commit comments