From 82e093490754ef84a431eaa43875e55cccc2d514 Mon Sep 17 00:00:00 2001 From: Greenlamp Date: Tue, 14 May 2024 03:00:34 +0200 Subject: [PATCH] added a test to fix unbinded key --- src/test/keyboard_remaping.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/keyboard_remaping.test.ts b/src/test/keyboard_remaping.test.ts index 7c2705ca7..4564f4243 100644 --- a/src/test/keyboard_remaping.test.ts +++ b/src/test/keyboard_remaping.test.ts @@ -265,4 +265,20 @@ describe('Test Keyboard', () => { expect(config.currentKeys[SettingInterfaceKeyboard.Button_Up].action).toEqual(Button.RIGHT); expect(config.currentKeys[SettingInterfaceKeyboard.Button_Up].icon).toEqual("T_D_Key_Dark.png"); }) + + + it('Swap alt with a key not binded yet', () => { + const settingNameA = SettingInterfaceKeyboard.Alt_Button_Up; + + expect(config.currentKeys[SettingInterfaceKeyboard.Alt_Button_Up].key).toEqual("KEY_Z"); + expect(config.currentKeys[SettingInterfaceKeyboard.Alt_Button_Up].action).toEqual(Button.UP); + expect(config.currentKeys[SettingInterfaceKeyboard.Alt_Button_Up].icon).toEqual("T_Z_Key_Dark.png"); + + swapCurrentKeys(config, SettingInterfaceKeyboard.Alt_Button_Up, Phaser.Input.Keyboard.KeyCodes.B); + + expect(config.currentKeys[SettingInterfaceKeyboard.Alt_Button_Up].key).toEqual("KEY_Z"); + expect(config.currentKeys[SettingInterfaceKeyboard.Alt_Button_Up].action).toEqual(Button.UP); + expect(config.currentKeys[SettingInterfaceKeyboard.Alt_Button_Up].icon).toEqual("T_B_Key_Dark.png"); + + }) }); \ No newline at end of file