Skip to content

Commit

Permalink
React snippet rendering: Add MDX test case
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed May 28, 2021
1 parent b55d051 commit d951eec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions addons/docs/src/frameworks/react/jsxDecorator.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,24 @@ describe('jsxDecorator', () => {
jsxDecorator(storyFn, context);
expect(transformSource).toHaveBeenCalledWith('<div>\n args story\n</div>', 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',
'<div className="foo" />'
);
});
});

0 comments on commit d951eec

Please sign in to comment.