test: add missing edge case for css v-bind

This commit is contained in:
Evan You 2022-01-23 21:03:37 +08:00
parent 16fa18da6d
commit 059c63eab7
2 changed files with 3 additions and 0 deletions

View File

@ -75,6 +75,7 @@ export default {
_useCssVars(_ctx => ({ _useCssVars(_ctx => ({
\\"xxxxxxxx-foo\\": (_unref(foo)), \\"xxxxxxxx-foo\\": (_unref(foo)),
\\"xxxxxxxx-foo____px_\\": (_unref(foo) + 'px'),
\\"xxxxxxxx-_a___b____2____px_\\": ((_unref(a) + _unref(b)) / 2 + 'px'), \\"xxxxxxxx-_a___b____2____px_\\": ((_unref(a) + _unref(b)) / 2 + 'px'),
\\"xxxxxxxx-__a___b______2___a_\\": (((_unref(a) + _unref(b))) / (2 * _unref(a))) \\"xxxxxxxx-__a___b______2___a_\\": (((_unref(a) + _unref(b))) / (2 * _unref(a)))
})) }))

View File

@ -210,6 +210,7 @@ describe('CSS vars injection', () => {
p{ p{
width: calc(v-bind(foo) - 3px); width: calc(v-bind(foo) - 3px);
height: calc(v-bind('foo') - 3px); height: calc(v-bind('foo') - 3px);
top: calc(v-bind(foo + 'px') - 3px);
} }
div { div {
color: v-bind((a + b) / 2 + 'px' ); color: v-bind((a + b) / 2 + 'px' );
@ -224,6 +225,7 @@ describe('CSS vars injection', () => {
) )
expect(content).toMatch(`_useCssVars(_ctx => ({ expect(content).toMatch(`_useCssVars(_ctx => ({
"${mockId}-foo": (_unref(foo)), "${mockId}-foo": (_unref(foo)),
"${mockId}-foo____px_": (_unref(foo) + 'px'),
"${mockId}-_a___b____2____px_": ((_unref(a) + _unref(b)) / 2 + 'px'), "${mockId}-_a___b____2____px_": ((_unref(a) + _unref(b)) / 2 + 'px'),
"${mockId}-__a___b______2___a_": (((_unref(a) + _unref(b))) / (2 * _unref(a))) "${mockId}-__a___b______2___a_": (((_unref(a) + _unref(b))) / (2 * _unref(a)))
})`) })`)