fix(compiler-core): fix property shorthand detection

fix #845
This commit is contained in:
Evan You
2020-03-16 10:27:03 -04:00
parent c7ae269972
commit 586e5bb800
2 changed files with 12 additions and 1 deletions

View File

@@ -317,6 +317,16 @@ describe('compiler: expression transform', () => {
})
})
test('should not duplicate object key with same name as value', () => {
const node = parseWithExpressionTransform(
`{{ { foo: foo } }}`
) as InterpolationNode
expect(node.content).toMatchObject({
type: NodeTypes.COMPOUND_EXPRESSION,
children: [`{ foo: `, { content: `_ctx.foo` }, ` }`]
})
})
test('should prefix a computed object property key', () => {
const node = parseWithExpressionTransform(
`{{ { [foo]: bar } }}`