summaryrefslogtreecommitdiff
path: root/test/lisp/help-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/help-tests.el')
-rw-r--r--test/lisp/help-tests.el29
1 files changed, 26 insertions, 3 deletions
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el
index 8034764741c..871417da3d2 100644
--- a/test/lisp/help-tests.el
+++ b/test/lisp/help-tests.el
@@ -26,6 +26,7 @@
(require 'ert)
(eval-when-compile (require 'cl-lib))
+(require 'text-property-search) ; for `text-property-search-forward'
(ert-deftest help-split-fundoc-SECTION ()
"Test new optional arg SECTION."
@@ -60,9 +61,8 @@
(defmacro with-substitute-command-keys-test (&rest body)
`(cl-flet* ((test
(lambda (orig result)
- (should (equal-including-properties
- (substitute-command-keys orig)
- result))))
+ (should (equal (substitute-command-keys orig)
+ result))))
(test-re
(lambda (orig regexp)
(should (string-match (concat "^" regexp "$")
@@ -110,14 +110,19 @@ C-<tab> file-cache-minibuffer-complete
<prior> switch-to-completions
<up> previous-line-or-history-element
+M-g Prefix Command
M-v switch-to-completions
+M-g ESC Prefix Command
+
M-< minibuffer-beginning-of-buffer
M-n next-history-element
M-p previous-history-element
M-r previous-matching-history-element
M-s next-matching-history-element
+M-g M-c switch-to-completions
+
")))
(ert-deftest help-tests-substitute-command-keys/keymap-change ()
@@ -222,6 +227,24 @@ M-s next-matching-history-element
(define-minor-mode help-tests-minor-mode
"Minor mode for testing shadowing.")
+(ert-deftest help-tests-substitute-command-keys/add-key-face ()
+ (should (equal (substitute-command-keys "\\[next-line]")
+ (propertize "C-n"
+ 'face 'help-key-binding
+ 'font-lock-face 'help-key-binding))))
+
+(ert-deftest help-tests-substitute-command-keys/add-key-face-listing ()
+ (with-temp-buffer
+ (insert (substitute-command-keys "\\{help-tests-minor-mode-map}"))
+ (goto-char (point-min))
+ (text-property-search-forward 'face 'help-key-binding)
+ (should (looking-at "C-e"))
+ ;; Don't fontify trailing whitespace.
+ (should-not (get-text-property (+ (point) 3) 'face))
+ (text-property-search-forward 'face 'help-key-binding)
+ (should (looking-at "x"))
+ (should-not (get-text-property (+ (point) 1) 'face))))
+
(ert-deftest help-tests-substitute-command-keys/test-mode ()
(with-substitute-command-keys-test
(with-temp-buffer