aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMiodec <[email protected]>2024-10-16 14:31:06 +0200
committerMiodec <[email protected]>2024-10-16 14:46:54 +0200
commit5e35892e4756188dd842747b0e35bada004d1c83 (patch)
treef4b7cb98268d203469e3a660eeed4e8df3c03e4a
parent9f7aeac5af64938c321ebac8aa076d2e1144fd50 (diff)
downloadmonkeytype-5e35892e4756188dd842747b0e35bada004d1c83.tar.gz
monkeytype-5e35892e4756188dd842747b0e35bada004d1c83.zip
fix: unable to enable some layouts due to an incorrect schema
closes #5948
-rw-r--r--frontend/__tests__/root/config.spec.ts6
-rw-r--r--frontend/static/layouts/_list.json2
-rw-r--r--packages/contracts/src/schemas/configs.ts7
3 files changed, 9 insertions, 6 deletions
diff --git a/frontend/__tests__/root/config.spec.ts b/frontend/__tests__/root/config.spec.ts
index 9d9704907..251009468 100644
--- a/frontend/__tests__/root/config.spec.ts
+++ b/frontend/__tests__/root/config.spec.ts
@@ -439,8 +439,8 @@ describe("Config", () => {
it("setKeymapLayout", () => {
expect(Config.setKeymapLayout("overrideSync")).toBe(true);
expect(Config.setKeymapLayout("override_sync")).toBe(true);
- expect(Config.setKeymapLayout("override sync")).toBe(true);
- expect(Config.setKeymapLayout("override-sync!")).toBe(true);
+ expect(Config.setKeymapLayout("override sync")).toBe(false);
+ expect(Config.setKeymapLayout("override-sync!")).toBe(false);
expect(Config.setKeymapLayout(stringOfLength(50))).toBe(true);
expect(Config.setKeymapLayout(stringOfLength(51))).toBe(false);
@@ -451,7 +451,7 @@ describe("Config", () => {
expect(Config.setLayout(stringOfLength(50))).toBe(true);
expect(Config.setLayout("semi mak")).toBe(false);
- expect(Config.setLayout("semi-mak")).toBe(false);
+ expect(Config.setLayout("semi-mak")).toBe(true);
expect(Config.setLayout(stringOfLength(51))).toBe(false);
});
it("setFontSize", () => {
diff --git a/frontend/static/layouts/_list.json b/frontend/static/layouts/_list.json
index a75f81a16..9092d2dd4 100644
--- a/frontend/static/layouts/_list.json
+++ b/frontend/static/layouts/_list.json
@@ -1419,7 +1419,7 @@
"row5": [" "]
}
},
- "3l ": {
+ "3l": {
"keymapShowTopRow": false,
"type": "ansi",
"keys": {
diff --git a/packages/contracts/src/schemas/configs.ts b/packages/contracts/src/schemas/configs.ts
index 0465b57f3..b562994a1 100644
--- a/packages/contracts/src/schemas/configs.ts
+++ b/packages/contracts/src/schemas/configs.ts
@@ -265,10 +265,13 @@ export type ThemeName = z.infer<typeof ThemeNameSchema>;
export const KeymapLayoutSchema = z
.string()
.max(50)
- .regex(/[\w\-_]+/);
+ .regex(/^[a-zA-Z0-9\-_]+$/gi);
export type KeymapLayout = z.infer<typeof KeymapLayoutSchema>;
-export const LayoutSchema = token().max(50);
+export const LayoutSchema = z
+ .string()
+ .max(50)
+ .regex(/^[a-zA-Z0-9\-_]+$/gi);
export type Layout = z.infer<typeof LayoutSchema>;
export const FontSizeSchema = z.number().positive();