@@ -304,32 +304,32 @@ describe('codegen', () => {
304
304
it ( 'generate events with method call' , ( ) => {
305
305
assertCodegen (
306
306
'<input @input="onInput($event);">' ,
307
- `with(this){return _c('input',{on:{"input":function($event){onInput($event);}}})}`
307
+ `with(this){return _c('input',{on:{"input":function($event){return onInput($event);}}})}`
308
308
)
309
309
// empty arguments
310
310
assertCodegen (
311
311
'<input @input="onInput();">' ,
312
- `with(this){return _c('input',{on:{"input":function($event){onInput();}}})}`
312
+ `with(this){return _c('input',{on:{"input":function($event){return onInput();}}})}`
313
313
)
314
314
// without semicolon
315
315
assertCodegen (
316
316
'<input @input="onInput($event)">' ,
317
- `with(this){return _c('input',{on:{"input":function($event){onInput($event)}}})}`
317
+ `with(this){return _c('input',{on:{"input":function($event){return onInput($event)}}})}`
318
318
)
319
319
// multiple args
320
320
assertCodegen (
321
321
'<input @input="onInput($event, \'abc\', 5);">' ,
322
- `with(this){return _c('input',{on:{"input":function($event){onInput($event, 'abc', 5);}}})}`
322
+ `with(this){return _c('input',{on:{"input":function($event){return onInput($event, 'abc', 5);}}})}`
323
323
)
324
324
// expression in args
325
325
assertCodegen (
326
326
'<input @input="onInput($event, 2+2);">' ,
327
- `with(this){return _c('input',{on:{"input":function($event){onInput($event, 2+2);}}})}`
327
+ `with(this){return _c('input',{on:{"input":function($event){return onInput($event, 2+2);}}})}`
328
328
)
329
329
// tricky symbols in args
330
330
assertCodegen (
331
- ' <input @input="onInput(\ ');[\'());\ ');">' ,
332
- `with(this){return _c('input',{on:{"input":function($event){onInput(');[\'());');}}})}`
331
+ ` <input @input="onInput(');[\\ '());');">` ,
332
+ `with(this){return _c('input',{on:{"input":function($event){onInput(');[\\ '());');}}})}`
333
333
)
334
334
} )
335
335
0 commit comments