From b7ac93d78bb4ff29e2de49bf2ce60922a92be94a Mon Sep 17 00:00:00 2001 From: Alex Van Liew Date: Thu, 2 Jun 2022 09:56:22 -0700 Subject: [PATCH 1/2] fix(compat): respect v-model in vue 2 with compat build --- src/stubs.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/stubs.ts b/src/stubs.ts index 3c04b3509..882587afe 100644 --- a/src/stubs.ts +++ b/src/stubs.ts @@ -83,13 +83,16 @@ export const createStub = ({ const anonName = 'anonymous-stub' const tag = name ? `${hyphenate(name)}-stub` : anonName - const propsDeclaration = type - ? unwrapLegacyVueExtendComponent(type).props || {} + const componentOptions = type + ? unwrapLegacyVueExtendComponent(type) || {} : {} return defineComponent({ name: name || anonName, - props: propsDeclaration, + props: componentOptions.props || {}, + // fix #1550 - respect old-style v-model for shallow mounted components with @vue/compat + // @ts-ignore + model: componentOptions.model, setup(props, { slots }) { return () => { // https://github.com/vuejs/test-utils/issues/1076 From 60031d182593bc86af65f95c183e3689bd707815 Mon Sep 17 00:00:00 2001 From: Alex Van Liew Date: Sun, 5 Jun 2022 18:58:18 -0700 Subject: [PATCH 2/2] change ts-ignore --- src/stubs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stubs.ts b/src/stubs.ts index 882587afe..861323503 100644 --- a/src/stubs.ts +++ b/src/stubs.ts @@ -91,7 +91,7 @@ export const createStub = ({ name: name || anonName, props: componentOptions.props || {}, // fix #1550 - respect old-style v-model for shallow mounted components with @vue/compat - // @ts-ignore + // @ts-expect-error model: componentOptions.model, setup(props, { slots }) { return () => {