@@ -224,17 +224,17 @@ describe('codegen', () => {
224224 it ( 'generate events with keycode' , ( ) => {
225225 assertCodegen (
226226 '<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)}}})}`
228228 )
229229 // multiple keycodes (delete)
230230 assertCodegen (
231231 '<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)}}})}`
233233 )
234234 // multiple keycodes (chained)
235235 assertCodegen (
236236 '<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)}}})}`
238238 )
239239 // number keycode
240240 assertCodegen (
@@ -244,7 +244,7 @@ describe('codegen', () => {
244244 // custom keycode
245245 assertCodegen (
246246 '<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)}}})}`
248248 )
249249 } )
250250
0 commit comments