]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: use refTransform instead of deprecated refSugar (#4957)
authorCédric Exbrayat <cexbrayat@users.noreply.github.com>
Thu, 25 Nov 2021 09:39:36 +0000 (10:39 +0100)
committerGitHub <noreply@github.com>
Thu, 25 Nov 2021 09:39:36 +0000 (04:39 -0500)
packages/compiler-sfc/__tests__/compileScript.spec.ts
packages/compiler-sfc/__tests__/compileScriptRefTransform.spec.ts

index 694619174e51555f3aee5ef83a35e1c4dcd4027e..85b9f9a41ae3eb1e10c232abbbd1f5d1ba7d675c 100644 (file)
@@ -292,7 +292,7 @@ defineExpose({ foo: 123 })
       let foo = $ref(1)
       </script>
       `,
-        { refSugar: true }
+        { refTransform: true }
       )
       assertCode(content)
       expect(content).toMatch(`import { ref } from 'vue'`)
@@ -1090,7 +1090,7 @@ const emit = defineEmits(['a', 'b'])
   describe('async/await detection', () => {
     function assertAwaitDetection(code: string, shouldAsync = true) {
       const { content } = compile(`<script setup>${code}</script>`, {
-        refSugar: true
+        refTransform: true
       })
       if (shouldAsync) {
         expect(content).toMatch(`let __temp, __restore`)
index 34dc9efea323d2ca0ab9c0c885eb1fc54ba8e674..d2f52589003e72adb4d118025258e4a9ec98a4b3 100644 (file)
@@ -5,7 +5,7 @@ import { compileSFCScript as compile, assertCode } from './utils'
 // transform can be found in <root>/packages/ref-transform/__tests__
 describe('sfc ref transform', () => {
   function compileWithRefTransform(src: string) {
-    return compile(src, { refSugar: true })
+    return compile(src, { refTransform: true })
   }
 
   test('$ unwrapping', () => {
@@ -156,7 +156,7 @@ describe('sfc ref transform', () => {
           bar
         })
       </script>`,
-          { refSugar: true }
+          { refTransform: true }
         )
       ).toThrow(`cannot reference locally declared variables`)
 
@@ -168,7 +168,7 @@ describe('sfc ref transform', () => {
           bar
         })
       </script>`,
-          { refSugar: true }
+          { refTransform: true }
         )
       ).toThrow(`cannot reference locally declared variables`)
     })