Skip to content

Commit 8f9e85a

Browse files
committed
test: fix tests w/ nested CompoundExpressions
1 parent c952321 commit 8f9e85a

File tree

4 files changed

+43
-24
lines changed

4 files changed

+43
-24
lines changed

packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ exports[`compiler: codegen compound expression 1`] = `
9999
"
100100
return function render() {
101101
with (this) {
102-
return _ctx.foo + _toDisplayString(bar)
102+
return _ctx.foo + _toDisplayString(bar) + nested
103103
}
104104
}"
105105
`;

packages/compiler-core/__tests__/codegen.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,14 @@ describe('compiler: codegen', () => {
207207
type: NodeTypes.INTERPOLATION,
208208
loc: locStub,
209209
content: createSimpleExpression(`bar`, false, locStub)
210-
}
210+
},
211+
// nested compound
212+
createCompoundExpression([` + `, `nested`])
211213
])
212214
})
213215
)
214216
expect(code).toMatch(
215-
`return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar)`
217+
`return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar) + nested`
216218
)
217219
expect(code).toMatchSnapshot()
218220
})

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

+12-8
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,19 @@ describe('compiler: transform v-model', () => {
191191
children: [
192192
'$event => (',
193193
{
194-
content: '_ctx.model',
195-
isStatic: false
196-
},
197-
'[',
198-
{
199-
content: '_ctx.index',
200-
isStatic: false
194+
children: [
195+
{
196+
content: '_ctx.model',
197+
isStatic: false
198+
},
199+
'[',
200+
{
201+
content: '_ctx.index',
202+
isStatic: false
203+
},
204+
']'
205+
]
201206
},
202-
']',
203207
' = $event)'
204208
]
205209
}

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

+26-13
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,16 @@ describe('compiler: transform v-on', () => {
168168
type: NodeTypes.COMPOUND_EXPRESSION,
169169
children: [
170170
`$event => (`,
171-
{ content: `_ctx.foo` },
172-
`(`,
173-
// should NOT prefix $event
174-
{ content: `$event` },
175-
`)`,
171+
{
172+
type: NodeTypes.COMPOUND_EXPRESSION,
173+
children: [
174+
{ content: `_ctx.foo` },
175+
`(`,
176+
// should NOT prefix $event
177+
{ content: `$event` },
178+
`)`
179+
]
180+
},
176181
`)`
177182
]
178183
}
@@ -191,13 +196,17 @@ describe('compiler: transform v-on', () => {
191196
type: NodeTypes.COMPOUND_EXPRESSION,
192197
children: [
193198
`$event => {`,
194-
{ content: `_ctx.foo` },
195-
`(`,
196-
// should NOT prefix $event
197-
{ content: `$event` },
198-
`);`,
199-
{ content: `_ctx.bar` },
200-
`()`,
199+
{
200+
children: [
201+
{ content: `_ctx.foo` },
202+
`(`,
203+
// should NOT prefix $event
204+
{ content: `$event` },
205+
`);`,
206+
{ content: `_ctx.bar` },
207+
`()`
208+
]
209+
},
201210
`}`
202211
]
203212
}
@@ -363,7 +372,11 @@ describe('compiler: transform v-on', () => {
363372
index: 1,
364373
value: {
365374
type: NodeTypes.COMPOUND_EXPRESSION,
366-
children: [`$event => (`, { content: `_ctx.foo` }, `++`, `)`]
375+
children: [
376+
`$event => (`,
377+
{ children: [{ content: `_ctx.foo` }, `++`] },
378+
`)`
379+
]
367380
}
368381
})
369382
})

0 commit comments

Comments
 (0)