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 { ssrRenderAttrs: _ssrRenderAttrs, 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 { ssrRenderAttrs: _ssrRenderAttrs, ssrRenderList: _ssrRenderList } = require(\\"vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
_push(\`<\${
_ctx.someTag
}\${
_ssrRenderAttrs(_attrs)
}>\`)
_ssrRenderList(_ctx.list, (i) => {
_push(\`\`)
})
_push(\`\${_ctx.someTag}>\`)
}"
`)
})
test('with multi fragments children', () => {
expect(
compile(
`
ok
`
).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(\`\`)
}"
`)
})
test('attribute fallthrough', () => {
expect(
compile(
`
`
).code
).toMatchInlineSnapshot(`
"const { mergeProps: _mergeProps } = require(\\"vue\\")
const { ssrRenderAttrs: _ssrRenderAttrs } = require(\\"vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
_push(\`\`)
}"
`)
})
})