Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions frontend/__tests__/root/config-metadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ describe("ConfigMeta", () => {
{ value: false, given: { tapeMode: "word" } },
{ value: true, given: { tapeMode: "word" }, fail: true },
],
monkey: [{ value: false, given: { liveSpeedStyle: "text" } }],
liveSpeedStyle: [
{ value: "mini", given: { monkey: true } },
{ value: "text", given: { monkey: true } },
],
liveAccStyle: [
{ value: "mini", given: { monkey: true } },
{ value: "text", given: { monkey: true } },
],
};

it.for(
Expand Down Expand Up @@ -244,6 +253,45 @@ describe("ConfigMeta", () => {
expected: { freedomMode: false, stopOnError: "off" },
},
],
monkey: [
{
value: false,
given: { liveSpeedStyle: "text", liveAccStyle: "text" },
expected: {
liveSpeedStyle: "text",
liveAccStyle: "text",
},
},
{
value: true,
given: { liveSpeedStyle: "text", liveAccStyle: "text" },
expected: { liveSpeedStyle: "off", liveAccStyle: "off" },
},
],
liveSpeedStyle: [
{
value: "mini",
given: { monkey: true },
expected: { monkey: true },
},
{
value: "text",
given: { monkey: true },
expected: { monkey: false },
},
],
liveAccStyle: [
{
value: "mini",
given: { monkey: true },
expected: { monkey: true },
},
{
value: "text",
given: { monkey: true },
expected: { monkey: false },
},
],
tapeMode: [
{
value: "off",
Expand Down
44 changes: 44 additions & 0 deletions frontend/__tests__/root/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,50 @@ describe("Config", () => {
expect(Config.setConfig("showAllLines", true)).toBe(false);
});

it("disables live text stats when enabling monkey", () => {
//GIVEN
replaceConfig({
liveSpeedStyle: "text",
liveAccStyle: "text",
monkey: false,
});

//WHEN / THEN
expect(Config.setConfig("monkey", true)).toBe(true);
expect(getConfig()).toMatchObject({
monkey: true,
liveSpeedStyle: "off",
liveAccStyle: "off",
});
expect(notificationAddMock).not.toHaveBeenCalled();
});

it("disables monkey when enabling live speed text", () => {
//GIVEN
replaceConfig({ monkey: true, liveSpeedStyle: "off" });

//WHEN / THEN
expect(Config.setConfig("liveSpeedStyle", "text")).toBe(true);
expect(getConfig()).toMatchObject({
monkey: false,
liveSpeedStyle: "text",
});
expect(notificationAddMock).not.toHaveBeenCalled();
});

it("disables monkey when enabling live accuracy text", () => {
//GIVEN
replaceConfig({ monkey: true, liveAccStyle: "off" });

//WHEN / THEN
expect(Config.setConfig("liveAccStyle", "text")).toBe(true);
expect(getConfig()).toMatchObject({
monkey: false,
liveAccStyle: "text",
});
expect(notificationAddMock).not.toHaveBeenCalled();
});

it("should use overrideValue", () => {
//WHEN
Config.setConfig("customLayoutfluid", ["3l", "ABNT2", "3l"]);
Expand Down
31 changes: 31 additions & 0 deletions frontend/src/ts/config/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,29 @@ export const configMetadata: ConfigMetadataObject = {
displayString: "live speed style",
changeRequiresRestart: false,
group: "appearance",
overrideConfig: ({ value }) => {
if (value === "text") {
return {
monkey: false,
};
}
return {};
},
},
liveAccStyle: {
key: "liveAccStyle",
fa: { icon: "fa-tachometer-alt" },
displayString: "live accuracy style",
changeRequiresRestart: false,
group: "appearance",
overrideConfig: ({ value }) => {
if (value === "text") {
return {
monkey: false,
};
}
return {};
},
},
liveBurstStyle: {
key: "liveBurstStyle",
Expand Down Expand Up @@ -1005,6 +1021,21 @@ export const configMetadata: ConfigMetadataObject = {
displayString: "monkey",
changeRequiresRestart: false,
group: "hidden",
overrideConfig: ({ value, currentConfig }) => {
if (value) {
return {
liveSpeedStyle:
currentConfig.liveSpeedStyle === "text"
? "off"
: currentConfig.liveSpeedStyle,
liveAccStyle:
currentConfig.liveAccStyle === "text"
? "off"
: currentConfig.liveAccStyle,
};
}
return {};
},
},
monkeyPowerLevel: {
key: "monkeyPowerLevel",
Expand Down
Loading