|
|
@@ -141,6 +141,21 @@ const myEmit = defineEmits(['foo', 'bar'])
|
|
|
expect(content).toMatch(`emits: ['a'],`)
|
|
|
})
|
|
|
|
|
|
+ // vuejs/core #6757
|
|
|
+ test('defineProps/defineEmits in multi-variable declaration fix #6757 ', () => {
|
|
|
+ const { content } = compile(`
|
|
|
+ <script setup>
|
|
|
+ const a = 1,
|
|
|
+ props = defineProps(['item']),
|
|
|
+ emit = defineEmits(['a']);
|
|
|
+ </script>
|
|
|
+ `)
|
|
|
+ assertCode(content)
|
|
|
+ expect(content).toMatch(`const a = 1;`) // test correct removal
|
|
|
+ expect(content).toMatch(`props: ['item'],`)
|
|
|
+ expect(content).toMatch(`emits: ['a'],`)
|
|
|
+ })
|
|
|
+
|
|
|
test('defineProps/defineEmits in multi-variable declaration (full removal)', () => {
|
|
|
const { content } = compile(`
|
|
|
<script setup>
|