-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object spread #2328
Object spread #2328
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -895,10 +895,11 @@ test('jsx', async (t) => { | |
[ | ||
'/*@jsxRuntime automatic @jsxImportSource react*/', | ||
'function _createMdxContent(props) {', | ||
' const _components = Object.assign({', | ||
' const _components = {', | ||
' em: "em",', | ||
' p: "p"', | ||
' }, props.components);', | ||
' p: "p",', | ||
' ...props.components', | ||
' };', | ||
' return <_components.p><_components.em>{"a"}</_components.em></_components.p>;', | ||
'}', | ||
'function MDXContent(props = {}) {', | ||
|
@@ -978,9 +979,10 @@ test('jsx', async (t) => { | |
[ | ||
'/*@jsxRuntime automatic @jsxImportSource react*/', | ||
'function _createMdxContent(props) {', | ||
' const _components = Object.assign({', | ||
' "a-b": "a-b"', | ||
' }, props.components), _component0 = _components["a-b"];', | ||
' const _components = {', | ||
' "a-b": "a-b",', | ||
' ...props.components', | ||
' }, _component0 = _components["a-b"];', | ||
' return <>{<_component0></_component0>}</>;', | ||
'}', | ||
'function MDXContent(props = {}) {', | ||
|
@@ -999,9 +1001,10 @@ test('jsx', async (t) => { | |
[ | ||
'/*@jsxRuntime automatic @jsxImportSource react*/', | ||
'function _createMdxContent(props) {', | ||
' const _components = Object.assign({', | ||
' p: "p"', | ||
' }, props.components);', | ||
' const _components = {', | ||
' p: "p",', | ||
' ...props.components', | ||
' };', | ||
' return <_components.p>{"Hello "}{props.name}</_components.p>;', | ||
'}', | ||
'function MDXContent(props = {}) {', | ||
|
@@ -1030,9 +1033,10 @@ test('jsx', async (t) => { | |
' return <section {...props} />;', | ||
'};', | ||
'function _createMdxContent(props) {', | ||
' const _components = Object.assign({', | ||
' p: "p"', | ||
' }, props.components);', | ||
' const _components = {', | ||
' p: "p",', | ||
' ...props.components', | ||
' };', | ||
' return <_components.p>{"a"}</_components.p>;', | ||
'}', | ||
'function MDXContent(props = {}) {', | ||
|
@@ -1045,6 +1049,42 @@ test('jsx', async (t) => { | |
} | ||
) | ||
|
||
await t.test( | ||
'should combine passing `components` w/ props and a provider', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A test combining these was missing. |
||
() => { | ||
assert.equal( | ||
String( | ||
compileSync('a', { | ||
jsx: true, | ||
providerImportSource: '@mdx-js/react' | ||
}) | ||
), | ||
[ | ||
'/*@jsxRuntime automatic @jsxImportSource react*/', | ||
'import {useMDXComponents as _provideComponents} from "@mdx-js/react";', | ||
'function _createMdxContent(props) {', | ||
' const _components = {', | ||
' p: "p",', | ||
' ..._provideComponents(),', | ||
' ...props.components', | ||
' };', | ||
' return <_components.p>{"a"}</_components.p>;', | ||
'}', | ||
'function MDXContent(props = {}) {', | ||
' const {wrapper: MDXLayout} = {', | ||
' ..._provideComponents(),', | ||
' ...props.components', | ||
' };', | ||
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props} /></MDXLayout> : _createMdxContent(props);', | ||
|
||
'}', | ||
'export default MDXContent;', | ||
'' | ||
].join('\n') | ||
) | ||
} | ||
) | ||
|
||
await t.test('should serialize double quotes in attribute values', () => { | ||
assert.match( | ||
String(compileSync("{<w x='y \" z' />}", {jsx: true})), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ test('@mdx-js/rollup', async () => { | |
|
||
assert.equal( | ||
output[0].map ? output[0].map.mappings : undefined, | ||
';;;MAAaA,OAAU,GAAA,MAAAC,GAAA,CAAAC,QAAA,EAAA;AAAQ,EAAA,QAAA,EAAA,QAAA;;;;;;;AAE7B,IAAA,QAAA,EAAA,CAAA,SAAA,EAAAD,GAAA,CAAA,OAAA,EAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;', | ||
';;;MAAaA,OAAU,GAAA,MAAAC,GAAA,CAAAC,QAAA,EAAA;AAAQ,EAAA,QAAA,EAAA,QAAA;;;;;;;;AAE7B,IAAA,QAAA,EAAA,CAAA,SAAA,EAAAD,GAAA,CAAA,OAAA,EAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I honestly have no idea what this change means. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess another identifier was added |
||
'should add a source map' | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
else
was reached, but removing it doesn’t change the test output and I’m not sure what it’s for.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t remember and I don’t know from looking at just this PR