From 139104ba2695eecae672db98f978de78e17ab7e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=99=BD=E9=9B=BE=E4=B8=89=E8=AF=AD?=
<32354856+baiwusanyu-c@users.noreply.github.com>
Date: Tue, 28 Mar 2023 17:47:10 +0800
Subject: [PATCH] fix(compiler-sfc): use prependLeft to handle CSSVars (#7760)
---
packages/compiler-sfc/__tests__/cssVars.spec.ts | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/packages/compiler-sfc/__tests__/cssVars.spec.ts b/packages/compiler-sfc/__tests__/cssVars.spec.ts
index ffa5d4e798b..05e5f689ac9 100644
--- a/packages/compiler-sfc/__tests__/cssVars.spec.ts
+++ b/packages/compiler-sfc/__tests__/cssVars.spec.ts
@@ -255,5 +255,22 @@ describe('CSS vars injection', () => {
)
expect(cssVars).toMatchObject([`count.toString(`, `xxx`])
})
+
+ // #7759
+ test('It should correctly parse the case where there is no space after the script tag', () => {
+ const { content } = compileSFCScript(
+ `
+ `
+ )
+ expect(content).toMatch(
+ `export default {\n setup(__props, { expose }) {\n expose();\n\n_useCssVars(_ctx => ({\n "xxxxxxxx-background": (_unref(background))\n}))`
+ )
+ })
})
})