From fe5428db1207747886957b831d46d71ecb6fadaa Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 1 Dec 2020 12:43:59 -0500 Subject: [PATCH] fix(compiler-ssr): handle v-model checkbox with true-value binding --- .../compiler-ssr/__tests__/ssrVModel.spec.ts | 34 +++++++++++++++- .../src/transforms/ssrTransformElement.ts | 20 +++++++++- .../compiler-ssr/src/transforms/ssrVModel.ts | 39 +++++++++++++------ 3 files changed, 80 insertions(+), 13 deletions(-) diff --git a/packages/compiler-ssr/__tests__/ssrVModel.spec.ts b/packages/compiler-ssr/__tests__/ssrVModel.spec.ts index 18a03b11..21ce80a0 100644 --- a/packages/compiler-ssr/__tests__/ssrVModel.spec.ts +++ b/packages/compiler-ssr/__tests__/ssrVModel.spec.ts @@ -49,7 +49,7 @@ describe('ssr: v-model', () => { `) }) - test(' { + test('', () => { expect(compileWithWrapper(``).code) .toMatchInlineSnapshot(` "const { ssrLooseContain: _ssrLooseContain, ssrRenderAttrs: _ssrRenderAttrs } = require(\\"@vue/server-renderer\\") @@ -81,6 +81,38 @@ describe('ssr: v-model', () => { }>\`) }" `) + + expect( + compileWithWrapper( + `` + ).code + ).toMatchInlineSnapshot(` + "const { ssrLooseEqual: _ssrLooseEqual, ssrRenderAttrs: _ssrRenderAttrs } = require(\\"@vue/server-renderer\\") + + return function ssrRender(_ctx, _push, _parent, _attrs) { + _push(\`\`) + }" + `) + + expect( + compileWithWrapper( + `` + ).code + ).toMatchInlineSnapshot(` + "const { ssrLooseEqual: _ssrLooseEqual, ssrRenderAttrs: _ssrRenderAttrs } = require(\\"@vue/server-renderer\\") + + return function ssrRender(_ctx, _push, _parent, _attrs) { + _push(\`\`) + }" + `) }) test('