mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-06 05:26:54 +08:00
fix: unable to enable some layouts due to an incorrect schema
closes #5948
This commit is contained in:
parent
9f7aeac5af
commit
5e35892e47
3 changed files with 9 additions and 6 deletions
|
@ -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", () => {
|
||||
|
|
|
@ -1419,7 +1419,7 @@
|
|||
"row5": [" "]
|
||||
}
|
||||
},
|
||||
"3l ": {
|
||||
"3l": {
|
||||
"keymapShowTopRow": false,
|
||||
"type": "ansi",
|
||||
"keys": {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue