From: Evan You Date: Mon, 28 Jun 2021 20:27:30 +0000 (-0400) Subject: fix(compiler-sfc): fix defineProps/defineEmits usage in multi-variable declarations X-Git-Tag: v3.1.3~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=62c1b2f7dc4d2dd22a1b1ab1897f0ce765008d59;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-sfc): fix defineProps/defineEmits usage in multi-variable declarations fix #3739 --- diff --git a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap index 4164124a2b..36604db257 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap @@ -108,6 +108,38 @@ return { props, bar } }" `; +exports[`SFC compile + `) + 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 decalration (full removal)', () => { + const { content } = compile(` + + `) + assertCode(content) + expect(content).toMatch(`props: ['item'],`) + expect(content).toMatch(`emits: ['a'],`) + }) + test('defineExpose()', () => { const { content } = compile(`