aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Burkett2021-06-21 14:35:04 -0400
committerJustin Burkett2021-06-21 14:35:04 -0400
commit8d6d81da4c7be4c929e908b1737dfd6d4c2aaa63 (patch)
tree677b6db6fc5a6bf54c54c98735bd897a58e37bbe
parent4e592ed7b913aecd13ce8d4e316ca4f8e2f34d7c (diff)
downloademacs-8d6d81da4c7be4c929e908b1737dfd6d4c2aaa63.tar.gz
emacs-8d6d81da4c7be4c929e908b1737dfd6d4c2aaa63.zip
Expand get-keymap-bindings test
-rw-r--r--Cask1
-rw-r--r--which-key-tests.el21
2 files changed, 20 insertions, 2 deletions
diff --git a/Cask b/Cask
index 60fa07cbdf2..6ff7bbe21da 100644
--- a/Cask
+++ b/Cask
@@ -4,4 +4,5 @@
4(package-file "which-key.el") 4(package-file "which-key.el")
5 5
6(development 6(development
7 (depends-on "evil")
7 (depends-on "ert")) 8 (depends-on "ert"))
diff --git a/which-key-tests.el b/which-key-tests.el
index 17d5d0d4944..eeedb557370 100644
--- a/which-key-tests.el
+++ b/which-key-tests.el
@@ -141,24 +141,41 @@
141 141
142(ert-deftest which-key-test--get-keymap-bindings () 142(ert-deftest which-key-test--get-keymap-bindings ()
143 (let ((map (make-sparse-keymap)) 143 (let ((map (make-sparse-keymap))
144 (evil-local-mode t)
145 (evil-state 'normal)
144 which-key-replacement-alist) 146 which-key-replacement-alist)
147 (require 'evil)
145 (define-key map [which-key-a] '(which-key "blah")) 148 (define-key map [which-key-a] '(which-key "blah"))
146 (define-key map "b" 'ignore) 149 (define-key map "b" 'ignore)
147 (define-key map "c" "c") 150 (define-key map "c" "c")
148 (define-key map "dd" "dd") 151 (define-key map "dd" "dd")
149 (define-key map "eee" "eee") 152 (define-key map "eee" "eee")
150 (define-key map "f" [123 45 6]) 153 (define-key map "f" [123 45 6])
154 (define-key map (kbd "M-g g") "M-gg")
155 (evil-define-key* 'normal map (kbd "C-h") "C-h-normal")
156 (evil-define-key* 'insert map (kbd "C-h") "C-h-insert")
151 (should (equal 157 (should (equal
152 (sort (which-key--get-keymap-bindings map) 158 (sort (which-key--get-keymap-bindings map)
153 (lambda (a b) (string-lessp (car a) (car b)))) 159 (lambda (a b) (string-lessp (car a) (car b))))
154 '(("c" . "c") 160 '(("M-g" . "prefix")
161 ("c" . "c")
162 ("d" . "prefix")
163 ("e" . "prefix")
164 ("f" . "{ - C-f"))))
165 (should (equal
166 (sort (which-key--get-keymap-bindings map nil nil nil nil t)
167 (lambda (a b) (string-lessp (car a) (car b))))
168 '(("C-h" . "C-h-normal")
169 ("M-g" . "prefix")
170 ("c" . "c")
155 ("d" . "prefix") 171 ("d" . "prefix")
156 ("e" . "prefix") 172 ("e" . "prefix")
157 ("f" . "{ - C-f")))) 173 ("f" . "{ - C-f"))))
158 (should (equal 174 (should (equal
159 (sort (which-key--get-keymap-bindings map nil nil nil t) 175 (sort (which-key--get-keymap-bindings map nil nil nil t)
160 (lambda (a b) (string-lessp (car a) (car b)))) 176 (lambda (a b) (string-lessp (car a) (car b))))
161 '(("c" . "c") 177 '(("M-g g" . "M-gg")
178 ("c" . "c")
162 ("d d" . "dd") 179 ("d d" . "dd")
163 ("e e e" . "eee") 180 ("e e e" . "eee")
164 ("f" . "{ - C-f")))))) 181 ("f" . "{ - C-f"))))))