2023-10-24 09:36:10 +08:00
|
|
|
import { compile } from '../src'
|
|
|
|
|
|
|
|
describe('transition', () => {
|
|
|
|
test('basic', () => {
|
|
|
|
expect(compile(`<transition><div>foo</div></transition>`).code)
|
|
|
|
.toMatchInlineSnapshot(`
|
2023-12-05 10:47:38 +08:00
|
|
|
"const { ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer")
|
2023-10-24 09:36:10 +08:00
|
|
|
|
2023-12-05 10:47:38 +08:00
|
|
|
return function ssrRender(_ctx, _push, _parent, _attrs) {
|
|
|
|
_push(\`<div\${_ssrRenderAttrs(_attrs)}>foo</div>\`)
|
|
|
|
}"
|
|
|
|
`)
|
2023-10-24 09:36:10 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
test('with appear', () => {
|
|
|
|
expect(compile(`<transition appear><div>foo</div></transition>`).code)
|
|
|
|
.toMatchInlineSnapshot(`
|
2023-12-05 10:47:38 +08:00
|
|
|
"const { ssrRenderAttrs: _ssrRenderAttrs } = require("vue/server-renderer")
|
2023-10-24 09:36:10 +08:00
|
|
|
|
2023-12-05 10:47:38 +08:00
|
|
|
return function ssrRender(_ctx, _push, _parent, _attrs) {
|
|
|
|
_push(\`<template><div\${_ssrRenderAttrs(_attrs)}>foo</div></template>\`)
|
|
|
|
}"
|
|
|
|
`)
|
2023-10-24 09:36:10 +08:00
|
|
|
})
|
|
|
|
})
|