test(compiler-core): include test case for expression prefixing in assignments
This commit is contained in:
parent
4adc5042f9
commit
6be6c268e8
@ -402,6 +402,33 @@ describe('compiler: expression transform', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('should prefix in assignment', () => {
|
||||||
|
const node = parseWithExpressionTransform(
|
||||||
|
`{{ x = 1 }}`
|
||||||
|
) as InterpolationNode
|
||||||
|
expect(node.content).toMatchObject({
|
||||||
|
type: NodeTypes.COMPOUND_EXPRESSION,
|
||||||
|
children: [{ content: `_ctx.x` }, ` = 1`]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test('should prefix in assignment pattern', () => {
|
||||||
|
const node = parseWithExpressionTransform(
|
||||||
|
`{{ { x, y: [z] } = obj }}`
|
||||||
|
) as InterpolationNode
|
||||||
|
expect(node.content).toMatchObject({
|
||||||
|
type: NodeTypes.COMPOUND_EXPRESSION,
|
||||||
|
children: [
|
||||||
|
`{ x: `,
|
||||||
|
{ content: `_ctx.x` },
|
||||||
|
`, y: [`,
|
||||||
|
{ content: `_ctx.z` },
|
||||||
|
`] } = `,
|
||||||
|
{ content: `_ctx.obj` }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('ES Proposals support', () => {
|
describe('ES Proposals support', () => {
|
||||||
test('bigInt', () => {
|
test('bigInt', () => {
|
||||||
const node = parseWithExpressionTransform(
|
const node = parseWithExpressionTransform(
|
||||||
|
Loading…
Reference in New Issue
Block a user