test(compiler-ssr): v-for tests
This commit is contained in:
@@ -119,7 +119,23 @@ describe('ssr: v-if', () => {
|
||||
})
|
||||
|
||||
test('<template v-if> (with v-for inside)', () => {
|
||||
// TODO should not contain nested fragments
|
||||
expect(
|
||||
compile(`<template v-if="foo"><div v-for="i in list"/></template>`).code
|
||||
).toMatchInlineSnapshot(`
|
||||
"const { _renderList } = require(\\"@vue/server-renderer\\")
|
||||
|
||||
return function ssrRender(_ctx, _push, _parent) {
|
||||
if (_ctx.foo) {
|
||||
_push(\`<!---->\`)
|
||||
_renderList(_ctx.list, (i) => {
|
||||
_push(\`<div></div>\`)
|
||||
})
|
||||
_push(\`<!---->\`)
|
||||
} else {
|
||||
_push(\`<!---->\`)
|
||||
}
|
||||
}"
|
||||
`)
|
||||
})
|
||||
|
||||
test('<template v-if> + normal v-else', () => {
|
||||
|
||||
Reference in New Issue
Block a user