Skip to content

Commit 8b4487e

Browse files
authored
test(compiler-vapor): add test for .prop modifier with dynamic arg and prefixIdentifiers (#14139)
1 parent 313d172 commit 8b4487e

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

packages/compiler-vapor/__tests__/transforms/__snapshots__/vBind.spec.ts.snap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,17 @@ export function render(_ctx) {
471471
}"
472472
`;
473473
474+
exports[`compiler v-bind > .prop modifier w/ dynamic arg + prefixIdentifiers 1`] = `
475+
"import { setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue';
476+
const t0 = _template("<div></div>", true)
477+
478+
export function render(_ctx) {
479+
const n0 = t0()
480+
_renderEffect(() => _setDynamicProps(n0, [{ ["." + _ctx.foo(_ctx.bar)]: _ctx.id }]))
481+
return n0
482+
}"
483+
`;
484+
474485
exports[`compiler v-bind > .prop modifier w/ dynamic arg 1`] = `
475486
"import { setDynamicProps as _setDynamicProps, renderEffect as _renderEffect, template as _template } from 'vue';
476487
const t0 = _template("<div></div>", true)

packages/compiler-vapor/__tests__/transforms/vBind.spec.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,34 @@ describe('compiler v-bind', () => {
455455
)
456456
})
457457

458-
test.todo('.prop modifier w/ dynamic arg + prefixIdentifiers')
458+
test('.prop modifier w/ dynamic arg + prefixIdentifiers', () => {
459+
const { ir, code } = compileWithVBind(
460+
`<div v-bind:[foo(bar)].prop="id"/>`,
461+
{ prefixIdentifiers: true },
462+
)
463+
expect(code).matchSnapshot()
464+
expect(ir.block.effect[0].operations[0]).toMatchObject({
465+
type: IRNodeTypes.SET_DYNAMIC_PROPS,
466+
props: [
467+
[
468+
{
469+
key: {
470+
content: `foo(bar)`,
471+
isStatic: false,
472+
},
473+
values: [
474+
{
475+
content: `id`,
476+
isStatic: false,
477+
},
478+
],
479+
runtimeCamelize: false,
480+
modifier: '.',
481+
},
482+
],
483+
],
484+
})
485+
})
459486

460487
test('.prop modifier (shorthand)', () => {
461488
const { ir, code } = compileWithVBind(`<div .fooBar="id"/>`)

0 commit comments

Comments
 (0)