mirror of
https://github.com/vuejs/babel-plugin-jsx.git
synced 2025-06-07 18:14:29 +08:00
test: add jsx test case
This commit is contained in:
parent
0654b73e90
commit
30bc3b3afb
@ -80,3 +80,10 @@ defineComponent((props: {
|
|||||||
}
|
}
|
||||||
});"
|
});"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`resolve type > w/ tsx 1`] = `
|
||||||
|
"import { type SetupContext, defineComponent } from 'vue';
|
||||||
|
const Comp = defineComponent(() => {
|
||||||
|
return () => <div />;
|
||||||
|
}, {});"
|
||||||
|
`;
|
||||||
|
@ -2,7 +2,9 @@ import { transformAsync } from '@babel/core';
|
|||||||
import ResolveType from '../src';
|
import ResolveType from '../src';
|
||||||
|
|
||||||
async function transform(code: string): Promise<string> {
|
async function transform(code: string): Promise<string> {
|
||||||
const result = await transformAsync(code, { plugins: [ResolveType] });
|
const result = await transformAsync(code, {
|
||||||
|
plugins: [[ResolveType, { isTSX: true }]],
|
||||||
|
});
|
||||||
return result!.code!;
|
return result!.code!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,4 +74,16 @@ describe('resolve type', () => {
|
|||||||
expect(result).toMatchSnapshot();
|
expect(result).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('w/ tsx', async () => {
|
||||||
|
const result = await transform(
|
||||||
|
`
|
||||||
|
import { type SetupContext, defineComponent } from 'vue';
|
||||||
|
const Comp = defineComponent(() => {
|
||||||
|
return () => <div/ >;
|
||||||
|
});
|
||||||
|
`
|
||||||
|
);
|
||||||
|
expect(result).toMatchSnapshot();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user