test: add test to check all type references
This commit is contained in:
parent
eb68fd42d9
commit
f3afcba31e
|
|
@ -60,3 +60,27 @@ const props = defineProps({
|
||||||
</script>
|
</script>
|
||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`transformSFC > remove all type reference 1`] = `
|
||||||
|
"<script setup>
|
||||||
|
const array = [1, 2, 3];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
v-bind=\\"{ array }\\"
|
||||||
|
:prop=\\"(a) => a\\"
|
||||||
|
:prop2=\\"
|
||||||
|
(a) => {
|
||||||
|
let b = a;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
\\"
|
||||||
|
>
|
||||||
|
{{ true ? 123 : 0 }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
|
"
|
||||||
|
`;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,30 @@ describe('transformSFC', () => {
|
||||||
expect(result).toMatchSnapshot()
|
expect(result).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('remove all type reference', async () => {
|
||||||
|
const result = await transform({
|
||||||
|
filename: 'app.vue',
|
||||||
|
raw: `<script lang="ts" setup>
|
||||||
|
const array: (number | string)[] = [1, 2, 3]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-bind="{ array }" :prop="(a: number) => a" :prop2="(a: number) => {
|
||||||
|
let b: number = a
|
||||||
|
return b
|
||||||
|
}">
|
||||||
|
{{ true ? 123 as number : 0 }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
`,
|
||||||
|
config: {},
|
||||||
|
})
|
||||||
|
expect(result).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
|
||||||
it('defineProps', async () => {
|
it('defineProps', async () => {
|
||||||
const result = await transform({
|
const result = await transform({
|
||||||
filename: 'app.vue',
|
filename: 'app.vue',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user