mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 07:59:26 +02:00
* Added string utility package to replace util functions
* Changed string manipulation functions fully over to `change-case`
* Fixed missing comma in package.json
trailing commas when :(
* fixed lockfile
* Hopefully re-added all the string utils
* fixed package json
* Fixed remaining cases of regex + code dupliation
* Fixed more bugs and errors
* Moved around functions and hopefully fixed the regex issues
* Minor renaming
* Fixed incorrect casing on setting strings
pascal snake case 💀
* ran biome
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import { getIconForLatestInput, getSettingNameWithKeycode } from "#inputs/config-handler";
|
|
import { SettingKeyboard } from "#system/settings-keyboard";
|
|
import { toPascalSnakeCase } from "#utils/strings";
|
|
import { expect } from "vitest";
|
|
|
|
export class InGameManip {
|
|
private config;
|
|
private keycode;
|
|
private settingName;
|
|
private icon;
|
|
private configs;
|
|
private latestSource;
|
|
private selectedDevice;
|
|
|
|
constructor(configs, config, selectedDevice) {
|
|
this.config = config;
|
|
this.configs = configs;
|
|
this.selectedDevice = selectedDevice;
|
|
this.keycode = null;
|
|
this.settingName = null;
|
|
this.icon = null;
|
|
this.latestSource = null;
|
|
}
|
|
|
|
whenWePressOnKeyboard(keycode) {
|
|
this.keycode = Phaser.Input.Keyboard.KeyCodes[keycode.toUpperCase()];
|
|
return this;
|
|
}
|
|
|
|
nothingShouldHappen() {
|
|
const settingName = getSettingNameWithKeycode(this.config, this.keycode);
|
|
expect(settingName).toEqual(-1);
|
|
return this;
|
|
}
|
|
|
|
forTheWantedBind(settingName) {
|
|
if (!settingName.includes("Button_")) {
|
|
settingName = "Button_" + settingName;
|
|
}
|
|
this.settingName = SettingKeyboard[settingName];
|
|
return this;
|
|
}
|
|
|
|
weShouldSeeTheIcon(icon) {
|
|
if (!icon.includes("KEY_")) {
|
|
icon = "KEY_" + icon;
|
|
}
|
|
this.icon = this.config.icons[icon];
|
|
expect(getIconForLatestInput(this.configs, this.latestSource, this.selectedDevice, this.settingName)).toEqual(
|
|
this.icon,
|
|
);
|
|
return this;
|
|
}
|
|
|
|
forTheSource(source) {
|
|
this.latestSource = source;
|
|
return this;
|
|
}
|
|
|
|
weShouldTriggerTheButton(settingName) {
|
|
if (!settingName.includes("Button_")) {
|
|
settingName = "Button_" + settingName;
|
|
}
|
|
this.settingName = SettingKeyboard[toPascalSnakeCase(settingName)];
|
|
expect(getSettingNameWithKeycode(this.config, this.keycode)).toEqual(this.settingName);
|
|
return this;
|
|
}
|
|
}
|