refactor: use refTransform instead of deprecated refSugar (#4957)
This commit is contained in:
parent
c6cd6a7938
commit
c17cbdc28f
@ -292,7 +292,7 @@ defineExpose({ foo: 123 })
|
|||||||
let foo = $ref(1)
|
let foo = $ref(1)
|
||||||
</script>
|
</script>
|
||||||
`,
|
`,
|
||||||
{ refSugar: true }
|
{ refTransform: true }
|
||||||
)
|
)
|
||||||
assertCode(content)
|
assertCode(content)
|
||||||
expect(content).toMatch(`import { ref } from 'vue'`)
|
expect(content).toMatch(`import { ref } from 'vue'`)
|
||||||
@ -1090,7 +1090,7 @@ const emit = defineEmits(['a', 'b'])
|
|||||||
describe('async/await detection', () => {
|
describe('async/await detection', () => {
|
||||||
function assertAwaitDetection(code: string, shouldAsync = true) {
|
function assertAwaitDetection(code: string, shouldAsync = true) {
|
||||||
const { content } = compile(`<script setup>${code}</script>`, {
|
const { content } = compile(`<script setup>${code}</script>`, {
|
||||||
refSugar: true
|
refTransform: true
|
||||||
})
|
})
|
||||||
if (shouldAsync) {
|
if (shouldAsync) {
|
||||||
expect(content).toMatch(`let __temp, __restore`)
|
expect(content).toMatch(`let __temp, __restore`)
|
||||||
|
@ -5,7 +5,7 @@ import { compileSFCScript as compile, assertCode } from './utils'
|
|||||||
// transform can be found in <root>/packages/ref-transform/__tests__
|
// transform can be found in <root>/packages/ref-transform/__tests__
|
||||||
describe('sfc ref transform', () => {
|
describe('sfc ref transform', () => {
|
||||||
function compileWithRefTransform(src: string) {
|
function compileWithRefTransform(src: string) {
|
||||||
return compile(src, { refSugar: true })
|
return compile(src, { refTransform: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
test('$ unwrapping', () => {
|
test('$ unwrapping', () => {
|
||||||
@ -156,7 +156,7 @@ describe('sfc ref transform', () => {
|
|||||||
bar
|
bar
|
||||||
})
|
})
|
||||||
</script>`,
|
</script>`,
|
||||||
{ refSugar: true }
|
{ refTransform: true }
|
||||||
)
|
)
|
||||||
).toThrow(`cannot reference locally declared variables`)
|
).toThrow(`cannot reference locally declared variables`)
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ describe('sfc ref transform', () => {
|
|||||||
bar
|
bar
|
||||||
})
|
})
|
||||||
</script>`,
|
</script>`,
|
||||||
{ refSugar: true }
|
{ refTransform: true }
|
||||||
)
|
)
|
||||||
).toThrow(`cannot reference locally declared variables`)
|
).toThrow(`cannot reference locally declared variables`)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user