Documentation
    Preparing search index...

    Type Alias MockKeysService

    MockKeysService: MockService<MockKeysState> & {
        pressKey(windowId: string, combo: string): string[];
        rebind(windowId: string, actionId: string, combo: string | null): boolean;
    }

    The keys mock service with its pressKey and rebind controls.

    Type Declaration

    • pressKey: function
      • Simulate the shell matching a combo for a window and push keys.action for every action bound to it.

        Parameters

        • windowId: string

          Target window.

        • combo: string

          Combo such as Ctrl+S (normalized before matching).

        Returns string[]

        Action ids that were triggered.

    • rebind: function
      • Simulate the user rebinding (or unbinding with null) an action, then push the window's complete keys.bindings.

        Parameters

        • windowId: string

          Owning window.

        • actionId: string

          Registered action id.

        • combo: string | null

          New combo, or null to unbind.

        Returns boolean

        false when the action is unknown or the combo is invalid/reserved.

    const keys = createMockKeysService();
    keys.pressKey('w1', 'Ctrl+S'); // pushes keys.action for the bound action