1
1
import { BindingTypes } from '@vue/compiler-core'
2
- import { compileSFCScript as compile , assertCode } from './utils'
2
+ import { compileSFCScript as compile , assertCode , mockId } from './utils'
3
3
4
4
describe ( 'SFC compile <script setup>' , ( ) => {
5
5
test ( 'should expose top level declarations' , ( ) => {
@@ -168,7 +168,7 @@ defineExpose({ foo: 123 })
168
168
expect ( content ) . toMatch ( / \b e x p o s e \( \{ f o o : 1 2 3 \} \) / )
169
169
} )
170
170
171
- test ( '<script> after <script setup> the script content not end with `\\n`' , ( ) => {
171
+ test ( '<script> after <script setup> the script content not end with `\\n`' , ( ) => {
172
172
const { content } = compile ( `
173
173
<script setup>
174
174
import { x } from './x'
@@ -726,6 +726,8 @@ defineExpose({ foo: 123 })
726
726
expect ( content ) . toMatch ( `\n __ssrInlineRender: true,\n` )
727
727
expect ( content ) . toMatch ( `return (_ctx, _push` )
728
728
expect ( content ) . toMatch ( `ssrInterpolate` )
729
+ expect ( content ) . not . toMatch ( `useCssVars` )
730
+ expect ( content ) . toMatch ( `"--${ mockId } -count": (count.value)` )
729
731
assertCode ( content )
730
732
} )
731
733
} )
@@ -1196,7 +1198,7 @@ const emit = defineEmits(['a', 'b'])
1196
1198
} )
1197
1199
1198
1200
test ( 'multiple `if` nested statements' , ( ) => {
1199
- assertAwaitDetection ( `if (ok) {
1201
+ assertAwaitDetection ( `if (ok) {
1200
1202
let a = 'foo'
1201
1203
await 0 + await 1
1202
1204
await 2
@@ -1212,13 +1214,13 @@ const emit = defineEmits(['a', 'b'])
1212
1214
await 3
1213
1215
await 4
1214
1216
}
1215
- } else {
1217
+ } else {
1216
1218
await 5
1217
1219
}` )
1218
1220
} )
1219
1221
1220
1222
test ( 'multiple `if while` nested statements' , ( ) => {
1221
- assertAwaitDetection ( `if (ok) {
1223
+ assertAwaitDetection ( `if (ok) {
1222
1224
while (d) {
1223
1225
await 5
1224
1226
}
@@ -1237,7 +1239,7 @@ const emit = defineEmits(['a', 'b'])
1237
1239
} )
1238
1240
1239
1241
test ( 'multiple `if for` nested statements' , ( ) => {
1240
- assertAwaitDetection ( `if (ok) {
1242
+ assertAwaitDetection ( `if (ok) {
1241
1243
for (let a of [1,2,3]) {
1242
1244
await a
1243
1245
}
0 commit comments