test: fix tests w/ nested CompoundExpressions
This commit is contained in:
parent
c952321fcf
commit
8f9e85afb1
@ -99,7 +99,7 @@ exports[`compiler: codegen compound expression 1`] = `
|
|||||||
"
|
"
|
||||||
return function render() {
|
return function render() {
|
||||||
with (this) {
|
with (this) {
|
||||||
return _ctx.foo + _toDisplayString(bar)
|
return _ctx.foo + _toDisplayString(bar) + nested
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
`;
|
`;
|
||||||
|
@ -207,12 +207,14 @@ describe('compiler: codegen', () => {
|
|||||||
type: NodeTypes.INTERPOLATION,
|
type: NodeTypes.INTERPOLATION,
|
||||||
loc: locStub,
|
loc: locStub,
|
||||||
content: createSimpleExpression(`bar`, false, locStub)
|
content: createSimpleExpression(`bar`, false, locStub)
|
||||||
}
|
},
|
||||||
|
// nested compound
|
||||||
|
createCompoundExpression([` + `, `nested`])
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
expect(code).toMatch(
|
expect(code).toMatch(
|
||||||
`return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar)`
|
`return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar) + nested`
|
||||||
)
|
)
|
||||||
expect(code).toMatchSnapshot()
|
expect(code).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
@ -191,15 +191,19 @@ describe('compiler: transform v-model', () => {
|
|||||||
children: [
|
children: [
|
||||||
'$event => (',
|
'$event => (',
|
||||||
{
|
{
|
||||||
content: '_ctx.model',
|
children: [
|
||||||
isStatic: false
|
{
|
||||||
|
content: '_ctx.model',
|
||||||
|
isStatic: false
|
||||||
|
},
|
||||||
|
'[',
|
||||||
|
{
|
||||||
|
content: '_ctx.index',
|
||||||
|
isStatic: false
|
||||||
|
},
|
||||||
|
']'
|
||||||
|
]
|
||||||
},
|
},
|
||||||
'[',
|
|
||||||
{
|
|
||||||
content: '_ctx.index',
|
|
||||||
isStatic: false
|
|
||||||
},
|
|
||||||
']',
|
|
||||||
' = $event)'
|
' = $event)'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -168,11 +168,16 @@ describe('compiler: transform v-on', () => {
|
|||||||
type: NodeTypes.COMPOUND_EXPRESSION,
|
type: NodeTypes.COMPOUND_EXPRESSION,
|
||||||
children: [
|
children: [
|
||||||
`$event => (`,
|
`$event => (`,
|
||||||
{ content: `_ctx.foo` },
|
{
|
||||||
`(`,
|
type: NodeTypes.COMPOUND_EXPRESSION,
|
||||||
// should NOT prefix $event
|
children: [
|
||||||
{ content: `$event` },
|
{ content: `_ctx.foo` },
|
||||||
`)`,
|
`(`,
|
||||||
|
// should NOT prefix $event
|
||||||
|
{ content: `$event` },
|
||||||
|
`)`
|
||||||
|
]
|
||||||
|
},
|
||||||
`)`
|
`)`
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -191,13 +196,17 @@ describe('compiler: transform v-on', () => {
|
|||||||
type: NodeTypes.COMPOUND_EXPRESSION,
|
type: NodeTypes.COMPOUND_EXPRESSION,
|
||||||
children: [
|
children: [
|
||||||
`$event => {`,
|
`$event => {`,
|
||||||
{ content: `_ctx.foo` },
|
{
|
||||||
`(`,
|
children: [
|
||||||
// should NOT prefix $event
|
{ content: `_ctx.foo` },
|
||||||
{ content: `$event` },
|
`(`,
|
||||||
`);`,
|
// should NOT prefix $event
|
||||||
{ content: `_ctx.bar` },
|
{ content: `$event` },
|
||||||
`()`,
|
`);`,
|
||||||
|
{ content: `_ctx.bar` },
|
||||||
|
`()`
|
||||||
|
]
|
||||||
|
},
|
||||||
`}`
|
`}`
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -363,7 +372,11 @@ describe('compiler: transform v-on', () => {
|
|||||||
index: 1,
|
index: 1,
|
||||||
value: {
|
value: {
|
||||||
type: NodeTypes.COMPOUND_EXPRESSION,
|
type: NodeTypes.COMPOUND_EXPRESSION,
|
||||||
children: [`$event => (`, { content: `_ctx.foo` }, `++`, `)`]
|
children: [
|
||||||
|
`$event => (`,
|
||||||
|
{ children: [{ content: `_ctx.foo` }, `++`] },
|
||||||
|
`)`
|
||||||
|
]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user