fix(compiler-sfc): improve css v-bind parsing

fix #6022
This commit is contained in:
Evan You
2022-06-06 20:02:08 +08:00
parent 9734b31c31
commit e60244bcdf
2 changed files with 88 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
import { compileStyle } from '../src'
import { compileStyle, parse } from '../src'
import { mockId, compileSFCScript, assertCode } from './utils'
describe('CSS vars injection', () => {
@@ -231,5 +231,21 @@ describe('CSS vars injection', () => {
})`)
assertCode(content)
})
// #6022
test('should be able to parse incomplete expressions', () => {
const {
descriptor: { cssVars }
} = parse(
`<script setup>let xxx = 1</script>
<style scoped>
label {
font-weight: v-bind("count.toString(");
font-weight: v-bind(xxx);
}
</style>`
)
expect(cssVars).toMatchObject([`count.toString(`, `xxx`])
})
})
})