From 059c63eab7e1e62a400a6608989f4a8545c097c6 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 23 Jan 2022 21:03:37 +0800 Subject: [PATCH] test: add missing edge case for css v-bind --- .../compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap | 1 + packages/compiler-sfc/__tests__/cssVars.spec.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap b/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap index c290eb6fee..49b0d712a7 100644 --- a/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap +++ b/packages/compiler-sfc/__tests__/__snapshots__/cssVars.spec.ts.snap @@ -75,6 +75,7 @@ export default { _useCssVars(_ctx => ({ \\"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___a_\\": (((_unref(a) + _unref(b))) / (2 * _unref(a))) })) diff --git a/packages/compiler-sfc/__tests__/cssVars.spec.ts b/packages/compiler-sfc/__tests__/cssVars.spec.ts index f92852e859..d9912f44b5 100644 --- a/packages/compiler-sfc/__tests__/cssVars.spec.ts +++ b/packages/compiler-sfc/__tests__/cssVars.spec.ts @@ -210,6 +210,7 @@ describe('CSS vars injection', () => { p{ width: calc(v-bind(foo) - 3px); height: calc(v-bind('foo') - 3px); + top: calc(v-bind(foo + 'px') - 3px); } div { color: v-bind((a + b) / 2 + 'px' ); @@ -224,6 +225,7 @@ describe('CSS vars injection', () => { ) expect(content).toMatch(`_useCssVars(_ctx => ({ "${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___a_": (((_unref(a) + _unref(b))) / (2 * _unref(a))) })`) -- 2.47.2