]> code.delx.au - gnu-emacs-elpa/commitdiff
Add: unit test for YAS-MINOR-MODE-MAP rebindings
authorJoão Távora <joaotavora@gmail.com>
Mon, 24 Dec 2012 01:45:59 +0000 (01:45 +0000)
committerJoão Távora <joaotavora@gmail.com>
Mon, 24 Dec 2012 01:45:59 +0000 (01:45 +0000)
yasnippet-tests.el

index 783eb3874c3c00ce6aed14e7253557a843e04c69..e8c4a110d58e277837d61c98ba13ecf80c0856ae 100644 (file)
@@ -462,6 +462,21 @@ TODO: be meaner"
     (should (eq (key-binding [(shift tab)]) 'yas-prev-field))
     (should (eq (key-binding [backtab]) 'yas-prev-field))))
 
+(ert-deftest test-rebindings ()
+  (unwind-protect
+      (progn
+        (define-key yas-minor-mode-map [tab] nil)
+        (define-key yas-minor-mode-map (kbd "TAB") nil)
+        (define-key yas-minor-mode-map (kbd "SPC") 'yas-expand)
+        (with-temp-buffer
+          (yas-minor-mode 1)
+          (should (not (eq (key-binding (yas--read-keybinding "TAB")) 'yas-expand)))
+          (should (eq (key-binding (yas--read-keybinding "SPC")) 'yas-expand))
+          (yas-reload-all)
+          (should (not (eq (key-binding (yas--read-keybinding "TAB")) 'yas-expand)))
+          (should (eq (key-binding (yas--read-keybinding "SPC")) 'yas-expand))))
+    (setcdr yas-minor-mode-map (cdr (yas--init-minor-keymap)))))
+
 (ert-deftest test-yas-in-org ()
   (with-temp-buffer
     (org-mode)