import { compile } from '../src' describe('ssr: attrs fallthrough', () => { test('basic', () => { expect(compile(`
`).code).toMatchInlineSnapshot(` "const { ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer") return function ssrRender(_ctx, _push, _parent, _attrs) { _push(\`
\`) }" `) }) test('with comments', () => { expect(compile(`
`).code).toMatchInlineSnapshot(` "const { ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer") return function ssrRender(_ctx, _push, _parent, _attrs) { _push(\`
\`) }" `) }) // #5140 test('should not inject to non-single-root if branches', () => { expect(compile(`
`).code).toMatchInlineSnapshot(` " return function ssrRender(_ctx, _push, _parent, _attrs) { _push(\`\`) if (true) { _push(\`
\`) } else { _push(\`\`) } _push(\`
\`) }" `) }) test('fallthrough component content (root with comments)', () => { expect(compile(`
`).code) .toMatchInlineSnapshot(` "const { ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer") return function ssrRender(_ctx, _push, _parent, _attrs) { _push(\`
\`) }" `) }) //#8072 test(`fallthrough component content (with whitespace: 'preserve')`, () => { expect( compile( ` Foo Bar `, { whitespace: 'preserve', }, ).code, ).toMatchInlineSnapshot(` "const { ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer") return function ssrRender(_ctx, _push, _parent, _attrs) { if (_ctx.to) { _push(\`Foo\`) } else { _push(\`Bar\`) } }" `) }) test('should not inject to fallthrough component content if not root', () => { expect(compile(`
`).code) .toMatchInlineSnapshot(` " return function ssrRender(_ctx, _push, _parent, _attrs) { _push(\`
\`) }" `) }) })