parent
c7ae269972
commit
586e5bb800
@ -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', () => {
|
test('should prefix a computed object property key', () => {
|
||||||
const node = parseWithExpressionTransform(
|
const node = parseWithExpressionTransform(
|
||||||
`{{ { [foo]: bar } }}`
|
`{{ { [foo]: bar } }}`
|
||||||
|
@ -271,7 +271,8 @@ const isPropertyShorthand = (node: Node, parent: Node) => {
|
|||||||
isStaticProperty(parent) &&
|
isStaticProperty(parent) &&
|
||||||
parent.value === node &&
|
parent.value === node &&
|
||||||
parent.key.type === 'Identifier' &&
|
parent.key.type === 'Identifier' &&
|
||||||
parent.key.name === (node as Identifier).name
|
parent.key.name === (node as Identifier).name &&
|
||||||
|
parent.key.start === node.start
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user