11import { it as effectIt } from "@effect/vitest" ;
22import * as HostProcess from "@t3tools/shared/HostProcess" ;
3+ import { parseKeybindingShortcut } from "@t3tools/shared/keybindings" ;
34import * as Effect from "effect/Effect" ;
45import { describe , expect , it } from "vite-plus/test" ;
56
@@ -9,6 +10,7 @@ import {
910 compactAccessibilityTree ,
1011 findAccessibleWindow ,
1112 isWaylandSession ,
13+ toElectronAccelerator ,
1214} from "./snapShot.ts" ;
1315
1416describe ( "accessibleWindowText" , ( ) => {
@@ -448,6 +450,21 @@ describe("findAccessibleWindow", () => {
448450 } ) ;
449451} ) ;
450452
453+ describe ( "toElectronAccelerator" , ( ) => {
454+ // The settings recorder stores shortcuts through parseKeybindingShortcut, which lowercases keys.
455+ it . each ( [
456+ [ "mod+shift+arrowup" , "CommandOrControl+Shift+Up" ] ,
457+ [ "mod+shift+arrowdown" , "CommandOrControl+Shift+Down" ] ,
458+ [ "ctrl+alt+arrowleft" , "Control+Alt+Left" ] ,
459+ [ "ctrl+alt+arrowright" , "Control+Alt+Right" ] ,
460+ [ "mod+shift+esc" , "CommandOrControl+Shift+Esc" ] ,
461+ [ "mod+shift+space" , "CommandOrControl+Shift+Space" ] ,
462+ [ "mod+shift+2" , "CommandOrControl+Shift+2" ] ,
463+ ] ) ( "maps a recorded %s to an Electron accelerator" , ( recorded , accelerator ) => {
464+ expect ( toElectronAccelerator ( parseKeybindingShortcut ( recorded ) ! ) ) . toBe ( accelerator ) ;
465+ } ) ;
466+ } ) ;
467+
451468describe ( "isWaylandSession" , ( ) => {
452469 effectIt . effect (
453470 "falls back to a live runtime directory socket when session variables are stripped" ,
0 commit comments