feat(desktop): add zen mode toggle for data tabs
This commit is contained in:
16 files changed
+105
-9
No files matched your search
@@ -9,6 +9,7 @@ import {
|
||||
isGoToLastPageShortcut,
|
||||
isGoToNextPageShortcut,
|
||||
isGoToPreviousPageShortcut,
|
||||
isToggleZenModeShortcut,
|
||||
matchesModifierOnlyShortcut,
|
||||
matchesShortcut,
|
||||
tabSwitcherDirectionFromShortcut,
|
||||
@@ -98,6 +99,14 @@ describe("keyboard shortcut matching", () => {
|
||||
expect(isExecuteSqlInNewResultTabShortcut({ key: "\\", metaKey: true }, { executeSqlInNewResultTab: "Mod+\\" })).toBe(true);
|
||||
});
|
||||
|
||||
it("matches the configurable Zen mode shortcut", () => {
|
||||
const platformModEvent = isMacShortcutPlatform() ? { key: "F12", metaKey: true, shiftKey: true } : { key: "F12", ctrlKey: true, shiftKey: true };
|
||||
|
||||
expect(isToggleZenModeShortcut(platformModEvent, { toggleZenMode: "Shift+Mod+F12" })).toBe(true);
|
||||
expect(isToggleZenModeShortcut({ ...platformModEvent, shiftKey: false }, { toggleZenMode: "Shift+Mod+F12" })).toBe(false);
|
||||
expect(isToggleZenModeShortcut(platformModEvent, { toggleZenMode: "" })).toBe(false);
|
||||
});
|
||||
|
||||
it("matches legacy plus-key shortcuts saved with plus as a separator", () => {
|
||||
expect(matchesShortcut({ key: "+", ctrlKey: true }, "Mod++", "Win32")).toBe(true);
|
||||
expect(matchesShortcut({ key: "+", ctrlKey: true, shiftKey: true }, "Shift+Mod++", "Win32")).toBe(true);
|
||||
|
||||
@@ -146,6 +146,14 @@ describe("shortcutRegistry editor actions", () => {
|
||||
expect(findShortcutConflict("find", DEFAULT_SHORTCUT_SETTINGS.find, DEFAULT_SHORTCUT_SETTINGS)).toBeNull();
|
||||
});
|
||||
|
||||
it("registers a conflict-free global shortcut for Zen mode", () => {
|
||||
const definition = SHORTCUT_DEFINITIONS.find((item) => item.id === "toggleZenMode");
|
||||
|
||||
expect(definition).toMatchObject({ labelKey: "settings.shortcutToggleZenMode", scope: "global", defaultShortcut: "Shift+Mod+F12" });
|
||||
expect(DEFAULT_SHORTCUT_SETTINGS.toggleZenMode).toBe("Shift+Mod+F12");
|
||||
expect(findShortcutConflict("toggleZenMode", DEFAULT_SHORTCUT_SETTINGS.toggleZenMode, DEFAULT_SHORTCUT_SETTINGS)).toBeNull();
|
||||
});
|
||||
|
||||
it("uses Shift+Enter for inserting a complete line below", () => {
|
||||
const definition = SHORTCUT_DEFINITIONS.find((item) => item.id === "insertLineBelow");
|
||||
|
||||
|
||||
Reference in new issue
Block a user