Skip to content

Commit

Permalink
fix(compiler-sfc): use prependLeft to handle CSSVars (#7760)
Browse files Browse the repository at this point in the history
  • Loading branch information
baiwusanyu-c authored Mar 28, 2023
1 parent b9dc1ad commit 139104b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/compiler-sfc/__tests__/cssVars.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
`<script setup>import { ref as _ref } from 'vue';
let background = _ref('red')
</script>
<style>
label {
background: v-bind(background);
}
</style>`
)
expect(content).toMatch(
`export default {\n setup(__props, { expose }) {\n expose();\n\n_useCssVars(_ctx => ({\n "xxxxxxxx-background": (_unref(background))\n}))`
)
})
})
})

0 comments on commit 139104b

Please sign in to comment.