@@ -3054,19 +3054,19 @@ def test_sdl2_image_formats(self):
30543054 @no_wasm64 ('SDL2 + wasm64' )
30553055 def test_sdl2_key (self ):
30563056 create_file ('pre.js' , '''
3057- function keydown(c ) {
3058- var event = new KeyboardEvent("keydown", { ' keyCode': c, ' charCode': c , 'view': window, 'bubbles': true, 'cancelable': true });
3057+ function keydown(keyCode, code ) {
3058+ var event = new KeyboardEvent("keydown", { keyCode, code, charCode: keyCode , 'view': window, 'bubbles': true, 'cancelable': true });
30593059 var prevented = !document.dispatchEvent(event);
30603060
30613061 //send keypress if not prevented
30623062 if (!prevented) {
3063- var event = new KeyboardEvent("keypress", { ' keyCode': c, ' charCode': c , 'view': window, 'bubbles': true, 'cancelable': true });
3063+ var event = new KeyboardEvent("keypress", { keyCode, code, charCode: keyCode , 'view': window, 'bubbles': true, 'cancelable': true });
30643064 document.dispatchEvent(event);
30653065 }
30663066 }
30673067
3068- function keyup(c ) {
3069- var event = new KeyboardEvent("keyup", { ' keyCode': c, ' charCode': c , 'view': window, 'bubbles': true, 'cancelable': true });
3068+ function keyup(keyCode, code ) {
3069+ var event = new KeyboardEvent("keyup", { keyCode, code, charCode: keyCode , 'view': window, 'bubbles': true, 'cancelable': true });
30703070 document.dispatchEvent(event);
30713071 }
30723072 ''' )
@@ -3281,8 +3281,8 @@ def test_sdl2_canvas_proxy(self):
32813281 def test_sdl2_pumpevents (self ):
32823282 # key events should be detected using SDL_PumpEvents
32833283 create_file ('pre.js' , '''
3284- function keydown(c ) {
3285- var event = new KeyboardEvent("keydown", { ' keyCode': c, ' charCode': c , 'view': window, 'bubbles': true, 'cancelable': true });
3284+ function keydown(keyCode, code ) {
3285+ var event = new KeyboardEvent("keydown", { keyCode, code, charCode: keyCode , 'view': window, 'bubbles': true, 'cancelable': true });
32863286 document.dispatchEvent(event);
32873287 }
32883288 ''' )
0 commit comments