From: edison Date: Tue, 25 Nov 2025 08:51:21 +0000 (+0800) Subject: test(compiler-vapor): add test for .prop modifier with dynamic arg and prefixIdentifi... X-Git-Tag: v3.6.0-alpha.6~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b4487e8dfb759c22761a4de9646c5dadce25b13;p=thirdparty%2Fvuejs%2Fcore.git test(compiler-vapor): add test for .prop modifier with dynamic arg and prefixIdentifiers (#14139) --- diff --git a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vBind.spec.ts.snap b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vBind.spec.ts.snap index bd02d764df..316cf92243 100644 --- a/packages/compiler-vapor/__tests__/transforms/__snapshots__/vBind.spec.ts.snap +++ b/packages/compiler-vapor/__tests__/transforms/__snapshots__/vBind.spec.ts.snap @@ -471,6 +471,17 @@ export function render(_ctx) { }" `; +exports[`compiler v-bind > .prop modifier w/ dynamic arg + prefixIdentifiers 1`] = ` +"import { setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue'; +const t0 = _template("
", true) + +export function render(_ctx) { + const n0 = t0() + _renderEffect(() => _setDynamicProps(n0, [{ ["." + _ctx.foo(_ctx.bar)]: _ctx.id }])) + return n0 +}" +`; + exports[`compiler v-bind > .prop modifier w/ dynamic arg 1`] = ` "import { setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue'; const t0 = _template("
", true) diff --git a/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts b/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts index 17295beeaa..ddbc125cd5 100644 --- a/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts @@ -455,7 +455,34 @@ describe('compiler v-bind', () => { ) }) - test.todo('.prop modifier w/ dynamic arg + prefixIdentifiers') + test('.prop modifier w/ dynamic arg + prefixIdentifiers', () => { + const { ir, code } = compileWithVBind( + `
`, + { prefixIdentifiers: true }, + ) + expect(code).matchSnapshot() + expect(ir.block.effect[0].operations[0]).toMatchObject({ + type: IRNodeTypes.SET_DYNAMIC_PROPS, + props: [ + [ + { + key: { + content: `foo(bar)`, + isStatic: false, + }, + values: [ + { + content: `id`, + isStatic: false, + }, + ], + runtimeCamelize: false, + modifier: '.', + }, + ], + ], + }) + }) test('.prop modifier (shorthand)', () => { const { ir, code } = compileWithVBind(`
`)