aboutsummaryrefslogtreecommitdiff
path: root/tests/test-system-commands-keymap.el
blob: ac78a25d590d21fe6279dc2b9e8804f005ea95ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;;; test-system-commands-keymap.el --- Tests for system command keymap -*- lexical-binding: t; -*-

;;; Commentary:

;; The system command keymap should remain mounted as a prefix under C-; ! so
;; which-key can show the documented subcommands.

;;; Code:

(require 'ert)

(defvar cj/custom-keymap (make-sparse-keymap)
  "Stub custom keymap for system-commands tests.")

(require 'system-commands)

(ert-deftest test-system-commands-keymap-normal-prefix-mounted ()
  "Normal: C-; ! remains a prefix keymap, not a direct command."
  (should (eq (keymap-lookup cj/custom-keymap "!")
              cj/system-command-map)))

(ert-deftest test-system-commands-keymap-normal-documented-subkeys ()
  "Normal: documented system command subkeys resolve under the prefix."
  (dolist (binding '(("!" . cj/system-command-menu)
                     ("L" . cj/system-cmd-logout)
                     ("r" . cj/system-cmd-reboot)
                     ("s" . cj/system-cmd-shutdown)
                     ("S" . cj/system-cmd-suspend)
                     ("l" . cj/system-cmd-lock)
                     ("E" . cj/system-cmd-exit-emacs)
                     ("e" . cj/system-cmd-restart-emacs)))
    (should (eq (keymap-lookup cj/system-command-map (car binding))
                (cdr binding)))))

(provide 'test-system-commands-keymap)
;;; test-system-commands-keymap.el ends here