Skip to content

Commit 6be6c26

Browse files
committed
test(compiler-core): include test case for expression prefixing in assignments
1 parent 4adc504 commit 6be6c26

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts

+27
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,33 @@ describe('compiler: expression transform', () => {
402402
)
403403
})
404404

405+
test('should prefix in assignment', () => {
406+
const node = parseWithExpressionTransform(
407+
`{{ x = 1 }}`
408+
) as InterpolationNode
409+
expect(node.content).toMatchObject({
410+
type: NodeTypes.COMPOUND_EXPRESSION,
411+
children: [{ content: `_ctx.x` }, ` = 1`]
412+
})
413+
})
414+
415+
test('should prefix in assignment pattern', () => {
416+
const node = parseWithExpressionTransform(
417+
`{{ { x, y: [z] } = obj }}`
418+
) as InterpolationNode
419+
expect(node.content).toMatchObject({
420+
type: NodeTypes.COMPOUND_EXPRESSION,
421+
children: [
422+
`{ x: `,
423+
{ content: `_ctx.x` },
424+
`, y: [`,
425+
{ content: `_ctx.z` },
426+
`] } = `,
427+
{ content: `_ctx.obj` }
428+
]
429+
})
430+
})
431+
405432
describe('ES Proposals support', () => {
406433
test('bigInt', () => {
407434
const node = parseWithExpressionTransform(

0 commit comments

Comments
 (0)