From d951eec91e92316150a2bd9876eeb12812a78fed Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Fri, 28 May 2021 16:03:20 +0800 Subject: [PATCH] React snippet rendering: Add MDX test case --- .../frameworks/react/jsxDecorator.test.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/docs/src/frameworks/react/jsxDecorator.test.tsx b/addons/docs/src/frameworks/react/jsxDecorator.test.tsx index 6230dddec2ad..63d98262f916 100644 --- a/addons/docs/src/frameworks/react/jsxDecorator.test.tsx +++ b/addons/docs/src/frameworks/react/jsxDecorator.test.tsx @@ -252,4 +252,24 @@ describe('jsxDecorator', () => { jsxDecorator(storyFn, context); expect(transformSource).toHaveBeenCalledWith('
\n args story\n
', context); }); + + it('renders MDX properly', () => { + // FIXME: generate this from actual MDX + const mdxElement = { + type: { displayName: 'MDXCreateElement' }, + props: { + mdxType: 'div', + originalType: 'div', + className: 'foo', + }, + }; + + jsxDecorator(() => mdxElement, makeContext('mdx-args', { __isArgsStory: true }, {})); + + expect(mockChannel.emit).toHaveBeenCalledWith( + SNIPPET_RENDERED, + 'jsx-test--mdx-args', + '
' + ); + }); });