blob: 6c5ba4c7ed900150f48ee517079905a15dfbdd4b (
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
|
;;; test-modeline-config--click-map.el --- Tests for cj/--modeline-click-map -*- lexical-binding: t; -*-
;;; Commentary:
;; cj/--modeline-click-map is the shared mode-line `local-map' builder extracted
;; from three clickable segments (buffer-name, vc, major-mode) that each spelled
;; out the same make-sparse-keymap + define-key dance.
;;; Code:
(require 'ert)
(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
(require 'modeline-config)
(ert-deftest test-modeline-click-map-binds-mouse-1-and-3 ()
"Normal: with both commands, mouse-1 and mouse-3 are bound."
(let ((map (cj/--modeline-click-map 'vc-diff 'vc-root-diff)))
(should (keymapp map))
(should (eq (lookup-key map [mode-line mouse-1]) 'vc-diff))
(should (eq (lookup-key map [mode-line mouse-3]) 'vc-root-diff))))
(ert-deftest test-modeline-click-map-mouse-1-only ()
"Boundary: with no MOUSE-3, only mouse-1 is bound."
(let ((map (cj/--modeline-click-map 'describe-mode)))
(should (eq (lookup-key map [mode-line mouse-1]) 'describe-mode))
(should (null (lookup-key map [mode-line mouse-3])))))
(provide 'test-modeline-config--click-map)
;;; test-modeline-config--click-map.el ends here
|