Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit df12acc

Browse files
committed
test: add more tests
1 parent 5b2131a commit df12acc

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

test/__snapshots__/transform.test.ts.snap

+60
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,66 @@ export default __sfc_main;
2222
2323
exports[`transform fixture Empty.vue 1`] = `""`;
2424
25+
exports[`transform fixture Macros.vue 1`] = `
26+
"<template>
27+
<div @click=\\"emit(props.msg)\\">{{ msg }}</div>
28+
</template>
29+
30+
<script >
31+
const __sfc_main = {};
32+
__sfc_main.props = {
33+
msg: String
34+
};
35+
36+
__sfc_main.setup = (__props, __ctx) => {
37+
const props = __props;
38+
const emit = __ctx.emit;
39+
return {
40+
props,
41+
emit
42+
};
43+
};
44+
45+
export default __sfc_main;
46+
</script>
47+
"
48+
`;
49+
50+
exports[`transform fixture MacrosType.vue 1`] = `
51+
"<template>
52+
<div @click=\\"emit(props.msg)\\">{{ msg }}</div>
53+
</template>
54+
55+
<script lang=\\"ts\\">
56+
const __sfc_main = {};
57+
__sfc_main.props = {
58+
msg: {
59+
key: \\"msg\\",
60+
required: false,
61+
type: [String],
62+
default: 'Hello'
63+
},
64+
value: {
65+
key: \\"value\\",
66+
required: true,
67+
type: [Number]
68+
}
69+
};
70+
71+
__sfc_main.setup = (__props, __ctx) => {
72+
const props = __props;
73+
const emit = __ctx.emit;
74+
return {
75+
props,
76+
emit
77+
};
78+
};
79+
80+
export default __sfc_main;
81+
</script>
82+
"
83+
`;
84+
2585
exports[`transform fixture Object1.vue 1`] = `
2686
"<template>
2787
<div>

test/fixtures/Macros.vue

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<div @click="emit(props.msg)">{{ msg }}</div>
3+
</template>
4+
5+
<script setup>
6+
const props = defineProps({
7+
msg: String,
8+
})
9+
10+
const emit = defineEmits()
11+
</script>

test/fixtures/MacrosType.vue

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<div @click="emit(props.msg)">{{ msg }}</div>
3+
</template>
4+
5+
<script setup lang="ts">
6+
const props = withDefaults(
7+
defineProps<{ msg: string; value: number }>(),
8+
{ msg: 'Hello' },
9+
)
10+
11+
const emit = defineEmits()
12+
</script>

0 commit comments

Comments
 (0)