Skip to content

Commit a5cf6a0

Browse files
committed
Fixed wrong tests
1 parent 5ef0558 commit a5cf6a0

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

packages/mdx/test/compile.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -778,16 +778,16 @@ test('jsx', async () => {
778778
String(compileSync('*a*', {jsx: true})),
779779
[
780780
'/*@jsxRuntime automatic @jsxImportSource react*/',
781+
'function _createMdxContent(props) {',
782+
' const _components = Object.assign({',
783+
' p: "p",',
784+
' em: "em"',
785+
' }, props.components);',
786+
' return <_components.p><_components.em>{"a"}</_components.em></_components.p>;',
787+
'}',
781788
'function MDXContent(props = {}) {',
782789
' const {wrapper: MDXLayout} = props.components || ({});',
783-
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent /></MDXLayout> : _createMdxContent();',
784-
' function _createMdxContent() {',
785-
' const _components = Object.assign({',
786-
' p: "p",',
787-
' em: "em"',
788-
' }, props.components);',
789-
' return <_components.p><_components.em>{"a"}</_components.em></_components.p>;',
790-
' }',
790+
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props} /></MDXLayout> : _createMdxContent(props);',
791791
'}',
792792
'export default MDXContent;',
793793
''
@@ -799,12 +799,12 @@ test('jsx', async () => {
799799
String(compileSync('<a {...b} c d="1" e={1} />', {jsx: true})),
800800
[
801801
'/*@jsxRuntime automatic @jsxImportSource react*/',
802+
'function _createMdxContent(props) {',
803+
' return <a {...b} c d="1" e={1} />;',
804+
'}',
802805
'function MDXContent(props = {}) {',
803806
' const {wrapper: MDXLayout} = props.components || ({});',
804-
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent /></MDXLayout> : _createMdxContent();',
805-
' function _createMdxContent() {',
806-
' return <a {...b} c d="1" e={1} />;',
807-
' }',
807+
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props} /></MDXLayout> : _createMdxContent(props);',
808808
'}',
809809
'export default MDXContent;',
810810
''
@@ -816,15 +816,15 @@ test('jsx', async () => {
816816
String(compileSync('<><a:b /><c.d/></>', {jsx: true})),
817817
[
818818
'/*@jsxRuntime automatic @jsxImportSource react*/',
819+
'function _createMdxContent(props) {',
820+
' const {c} = props.components || ({});',
821+
' if (!c) _missingMdxReference("c", false);',
822+
' if (!c.d) _missingMdxReference("c.d", true);',
823+
' return <><><a:b /><c.d /></></>;',
824+
'}',
819825
'function MDXContent(props = {}) {',
820826
' const {wrapper: MDXLayout} = props.components || ({});',
821-
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent /></MDXLayout> : _createMdxContent();',
822-
' function _createMdxContent() {',
823-
' const {c} = props.components || ({});',
824-
' if (!c) _missingMdxReference("c", false);',
825-
' if (!c.d) _missingMdxReference("c.d", true);',
826-
' return <><><a:b /><c.d /></></>;',
827-
' }',
827+
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props} /></MDXLayout> : _createMdxContent(props);',
828828
'}',
829829
'export default MDXContent;',
830830
'function _missingMdxReference(id, component) {',
@@ -840,12 +840,12 @@ test('jsx', async () => {
840840
[
841841
'/*@jsxRuntime automatic @jsxImportSource react*/',
842842
'/*1*/',
843+
'function _createMdxContent(props) {',
844+
' return <><>{"a "}{}{" b"}</></>;',
845+
'}',
843846
'function MDXContent(props = {}) {',
844847
' const {wrapper: MDXLayout} = props.components || ({});',
845-
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent /></MDXLayout> : _createMdxContent();',
846-
' function _createMdxContent() {',
847-
' return <><>{"a "}{}{" b"}</></>;',
848-
' }',
848+
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props} /></MDXLayout> : _createMdxContent(props);',
849849
'}',
850850
'export default MDXContent;',
851851
''
@@ -857,15 +857,15 @@ test('jsx', async () => {
857857
String(compileSync('{<a-b></a-b>}', {jsx: true})),
858858
[
859859
'/*@jsxRuntime automatic @jsxImportSource react*/',
860+
'function _createMdxContent(props) {',
861+
' const _components = Object.assign({',
862+
' "a-b": "a-b"',
863+
' }, props.components);',
864+
' return <>{<_components.a-b></_components.a-b>}</>;',
865+
'}',
860866
'function MDXContent(props = {}) {',
861867
' const {wrapper: MDXLayout} = props.components || ({});',
862-
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent /></MDXLayout> : _createMdxContent();',
863-
' function _createMdxContent() {',
864-
' const _components = Object.assign({',
865-
' "a-b": "a-b"',
866-
' }, props.components);',
867-
' return <>{<_components.a-b></_components.a-b>}</>;',
868-
' }',
868+
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props} /></MDXLayout> : _createMdxContent(props);',
869869
'}',
870870
'export default MDXContent;',
871871
''
@@ -877,15 +877,15 @@ test('jsx', async () => {
877877
String(compileSync('Hello {props.name}', {jsx: true})),
878878
[
879879
'/*@jsxRuntime automatic @jsxImportSource react*/',
880+
'function _createMdxContent(props) {',
881+
' const _components = Object.assign({',
882+
' p: "p"',
883+
' }, props.components);',
884+
' return <_components.p>{"Hello "}{props.name}</_components.p>;',
885+
'}',
880886
'function MDXContent(props = {}) {',
881887
' const {wrapper: MDXLayout} = props.components || ({});',
882-
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent /></MDXLayout> : _createMdxContent();',
883-
' function _createMdxContent() {',
884-
' const _components = Object.assign({',
885-
' p: "p"',
886-
' }, props.components);',
887-
' return <_components.p>{"Hello "}{props.name}</_components.p>;',
888-
' }',
888+
' return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props} /></MDXLayout> : _createMdxContent(props);',
889889
'}',
890890
'export default MDXContent;',
891891
''

packages/rollup/test/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test('@mdx-js/rollup', async () => {
3434

3535
assert.equal(
3636
output[0].map ? output[0].map.mappings : undefined,
37-
';;;MAAaA,OAAU,GAAA,MAAAC,GAAA,CAAAC,QAAA,EAAA;AAAQ,EAAA,QAAA,EAAA,QAAA;;;;;;;;;;;;AAE7B,MAAA,QAAA,EAAA,CAAA,SAAA,EAAAD,GAAA,CAAA,OAAA,EAAA,EAAA,CAAA,CAAA;;;;;;;',
37+
';;;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;;;;;;;;;;;;',
3838
'should add a source map'
3939
)
4040

0 commit comments

Comments
 (0)