@@ -224,17 +224,17 @@ describe('codegen', () => {
224
224
it ( 'generate events with keycode' , ( ) => {
225
225
assertCodegen (
226
226
'<input @input.enter="onInput">' ,
227
- `with(this){return _h('input',{on:{"input":function($event){if($event.keyCode!==13 )return;onInput($event)}}})}`
227
+ `with(this){return _h('input',{on:{"input":function($event){if(_k( $event.keyCode,"enter",13) )return;onInput($event)}}})}`
228
228
)
229
229
// multiple keycodes (delete)
230
230
assertCodegen (
231
231
'<input @input.delete="onInput">' ,
232
- `with(this){return _h('input',{on:{"input":function($event){if($event.keyCode!==8&&$event.keyCode!==46 )return;onInput($event)}}})}`
232
+ `with(this){return _h('input',{on:{"input":function($event){if(_k( $event.keyCode,"delete",[8,46]) )return;onInput($event)}}})}`
233
233
)
234
234
// multiple keycodes (chained)
235
235
assertCodegen (
236
236
'<input @keydown.enter.delete="onInput">' ,
237
- `with(this){return _h('input',{on:{"keydown":function($event){if($event.keyCode!==13&& $event.keyCode!==8&&$event.keyCode!==46 )return;onInput($event)}}})}`
237
+ `with(this){return _h('input',{on:{"keydown":function($event){if(_k( $event.keyCode,"enter",13)&&_k( $event.keyCode,"delete",[8,46]) )return;onInput($event)}}})}`
238
238
)
239
239
// number keycode
240
240
assertCodegen (
@@ -244,7 +244,7 @@ describe('codegen', () => {
244
244
// custom keycode
245
245
assertCodegen (
246
246
'<input @input.custom="onInput">' ,
247
- `with(this){return _h('input',{on:{"input":function($event){if($event.keyCode!==_k( "custom"))return;onInput($event)}}})}`
247
+ `with(this){return _h('input',{on:{"input":function($event){if(_k( $event.keyCode, "custom"))return;onInput($event)}}})}`
248
248
)
249
249
} )
250
250
0 commit comments