Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 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,19 @@ describe("ConfigMeta", () => {
{ value: false, given: { tapeMode: "word" } },
{ value: true, given: { tapeMode: "word" }, fail: true },
],
monkey: [
{ value: false, given: { liveSpeedStyle: "text" } },
{ value: true, given: { liveSpeedStyle: "text" }, fail: true },
{ value: true, given: { liveAccStyle: "text" }, fail: true },
],
liveSpeedStyle: [
{ value: "mini", given: { monkey: true } },
{ value: "text", given: { monkey: true }, fail: true },
],
liveAccStyle: [
{ value: "mini", given: { monkey: true } },
{ value: "text", given: { monkey: true }, fail: true },
],
};

it.for(
Expand Down
22 changes: 22 additions & 0 deletions frontend/__tests__/root/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ describe("Config", () => {
expect(Config.setConfig("showAllLines", true)).toBe(false);
});

it("shows a notice when monkey conflicts with live text stats", () => {
//GIVEN
replaceConfig({ liveSpeedStyle: "text", monkey: false });

//WHEN / THEN
expect(Config.setConfig("monkey", true)).toBe(false);
expect(notificationAddMock).toHaveBeenCalledWith(
"Monkey can't be enabled while live speed or live accuracy is set to text.",
);
});

it("shows a notice when live speed text conflicts with monkey", () => {
//GIVEN
replaceConfig({ monkey: true, liveSpeedStyle: "off" });

//WHEN / THEN
expect(Config.setConfig("liveSpeedStyle", "text")).toBe(false);
expect(notificationAddMock).toHaveBeenCalledWith(
"Live speed can't be set to text while monkey is enabled.",
);
});

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,31 @@ export const configMetadata: ConfigMetadataObject = {
displayString: "live speed style",
changeRequiresRestart: false,
group: "appearance",
isBlocked: ({ value, currentConfig }) => {
if (value === "text" && currentConfig.monkey) {
showNoticeNotification(
"Live speed can't be set to text while monkey is enabled.",
);
return true;
}
return false;
},
},
liveAccStyle: {
key: "liveAccStyle",
fa: { icon: "fa-tachometer-alt" },
displayString: "live accuracy style",
changeRequiresRestart: false,
group: "appearance",
isBlocked: ({ value, currentConfig }) => {
if (value === "text" && currentConfig.monkey) {
showNoticeNotification(
"Live accuracy can't be set to text while monkey is enabled.",
);
return true;
}
return false;
},
},
liveBurstStyle: {
key: "liveBurstStyle",
Expand Down Expand Up @@ -1005,6 +1023,19 @@ export const configMetadata: ConfigMetadataObject = {
displayString: "monkey",
changeRequiresRestart: false,
group: "hidden",
isBlocked: ({ value, currentConfig }) => {
if (
value &&
(currentConfig.liveSpeedStyle === "text" ||
currentConfig.liveAccStyle === "text")
) {
showNoticeNotification(
"Monkey can't be enabled while live speed or live accuracy is set to text.",
);
return true;
}
return false;
},
},
monkeyPowerLevel: {
key: "monkeyPowerLevel",
Expand Down
Loading