From 1035c6b51b9a2aaba9659f97710940af11cb43c3 Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 18 May 2022 09:31:31 +0800 Subject: [PATCH] chore: split ssr transition group tests --- .../__tests__/ssrComponent.spec.ts | 88 ------------------- .../__tests__/ssrTransitionGroup.spec.ts | 88 +++++++++++++++++++ 2 files changed, 88 insertions(+), 88 deletions(-) create mode 100644 packages/compiler-ssr/__tests__/ssrTransitionGroup.spec.ts diff --git a/packages/compiler-ssr/__tests__/ssrComponent.spec.ts b/packages/compiler-ssr/__tests__/ssrComponent.spec.ts index 2f279c090d2..24b926f83bc 100644 --- a/packages/compiler-ssr/__tests__/ssrComponent.spec.ts +++ b/packages/compiler-ssr/__tests__/ssrComponent.spec.ts @@ -367,94 +367,6 @@ describe('ssr: components', () => { `) }) }) - - // transition-group should flatten and concat its children fragments into - // a single one - describe('transition-group', () => { - test('basic', () => { - expect( - compile( - `
` - ).code - ).toMatchInlineSnapshot(` - "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") - - return function ssrRender(_ctx, _push, _parent, _attrs) { - _push(\`\`) - _ssrRenderList(_ctx.list, (i) => { - _push(\`
\`) - }) - _push(\`\`) - }" - `) - }) - - test('with static tag', () => { - expect( - compile( - `
` - ).code - ).toMatchInlineSnapshot(` - "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") - - return function ssrRender(_ctx, _push, _parent, _attrs) { - _push(\`
    \`) - _ssrRenderList(_ctx.list, (i) => { - _push(\`
    \`) - }) - _push(\`
\`) - }" - `) - }) - - test('with dynamic tag', () => { - expect( - compile( - `
` - ).code - ).toMatchInlineSnapshot(` - "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") - - return function ssrRender(_ctx, _push, _parent, _attrs) { - _push(\`<\${_ctx.someTag}>\`) - _ssrRenderList(_ctx.list, (i) => { - _push(\`
\`) - }) - _push(\`\`) - }" - `) - }) - - test('with multi fragments children', () => { - expect( - compile( - ` -
-
- - ` - ).code - ).toMatchInlineSnapshot(` - "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") - - return function ssrRender(_ctx, _push, _parent, _attrs) { - _push(\`\`) - _ssrRenderList(10, (i) => { - _push(\`
\`) - }) - _ssrRenderList(10, (i) => { - _push(\`
\`) - }) - if (_ctx.ok) { - _push(\`
ok
\`) - } else { - _push(\`\`) - } - _push(\`\`) - }" - `) - }) - }) }) describe('custom directive', () => { diff --git a/packages/compiler-ssr/__tests__/ssrTransitionGroup.spec.ts b/packages/compiler-ssr/__tests__/ssrTransitionGroup.spec.ts new file mode 100644 index 00000000000..aee771fb3fe --- /dev/null +++ b/packages/compiler-ssr/__tests__/ssrTransitionGroup.spec.ts @@ -0,0 +1,88 @@ +import { compile } from '../src' + +// transition-group should flatten and concat its children fragments into +// a single one +describe('transition-group', () => { + test('basic', () => { + expect( + compile(`
`) + .code + ).toMatchInlineSnapshot(` + "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") + + return function ssrRender(_ctx, _push, _parent, _attrs) { + _push(\`\`) + _ssrRenderList(_ctx.list, (i) => { + _push(\`
\`) + }) + _push(\`\`) + }" + `) + }) + + test('with static tag', () => { + expect( + compile( + `
` + ).code + ).toMatchInlineSnapshot(` + "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") + + return function ssrRender(_ctx, _push, _parent, _attrs) { + _push(\`
    \`) + _ssrRenderList(_ctx.list, (i) => { + _push(\`
    \`) + }) + _push(\`
\`) + }" + `) + }) + + test('with dynamic tag', () => { + expect( + compile( + `
` + ).code + ).toMatchInlineSnapshot(` + "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") + + return function ssrRender(_ctx, _push, _parent, _attrs) { + _push(\`<\${_ctx.someTag}>\`) + _ssrRenderList(_ctx.list, (i) => { + _push(\`
\`) + }) + _push(\`\`) + }" + `) + }) + + test('with multi fragments children', () => { + expect( + compile( + ` +
+
+ + ` + ).code + ).toMatchInlineSnapshot(` + "const { ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\") + + return function ssrRender(_ctx, _push, _parent, _attrs) { + _push(\`\`) + _ssrRenderList(10, (i) => { + _push(\`
\`) + }) + _ssrRenderList(10, (i) => { + _push(\`
\`) + }) + if (_ctx.ok) { + _push(\`
ok
\`) + } else { + _push(\`\`) + } + _push(\`\`) + }" + `) + }) +})