wip: more consistent compiler-sfc usage + inline mode for ssr
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BindingTypes } from '@vue/compiler-dom/src'
|
||||
import { BindingTypes } from '@vue/compiler-dom'
|
||||
import { compileSFCScript as compile, assertCode } from './utils'
|
||||
|
||||
describe('SFC compile <script setup>', () => {
|
||||
@@ -297,6 +297,34 @@ const bar = 1
|
||||
expect(content).toMatch(`{ lett: lett } = val`)
|
||||
assertCode(content)
|
||||
})
|
||||
|
||||
test('ssr codegen', () => {
|
||||
const { content } = compile(
|
||||
`
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
const count = ref(0)
|
||||
</script>
|
||||
<template>
|
||||
<div>{{ count }}</div>
|
||||
<div>static</div>
|
||||
</template>
|
||||
<style>
|
||||
div { color: v-bind(count) }
|
||||
</style>
|
||||
`,
|
||||
{
|
||||
inlineTemplate: true,
|
||||
templateOptions: {
|
||||
ssr: true
|
||||
}
|
||||
}
|
||||
)
|
||||
expect(content).toMatch(`\n __ssrInlineRender: true,\n`)
|
||||
expect(content).toMatch(`return (_ctx, _push`)
|
||||
expect(content).toMatch(`ssrInterpolate`)
|
||||
assertCode(content)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with TypeScript', () => {
|
||||
|
||||
Reference in New Issue
Block a user