Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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("<div></div>", 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("<div></div>", true)
Expand Down
29 changes: 28 additions & 1 deletion packages/compiler-vapor/__tests__/transforms/vBind.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
`<div v-bind:[foo(bar)].prop="id"/>`,
{ 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(`<div .fooBar="id"/>`)
Expand Down
Loading