aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStephen Berman2018-08-15 00:14:41 +0200
committerStephen Berman2018-08-15 00:14:41 +0200
commit6d24402d6358b2e6ccf78a6cb909723a5d18dd27 (patch)
tree81fb54f8783ed4a6722486433c10da852927b62b /test
parent5620d591ee67e5b31ca8d5aa0dcc1a13116b09a7 (diff)
downloademacs-6d24402d6358b2e6ccf78a6cb909723a5d18dd27.tar.gz
emacs-6d24402d6358b2e6ccf78a6cb909723a5d18dd27.zip
Fix last todo-edit-mode change
* lisp/calendar/todo-mode.el (todo-edit-mode): For editing an item instead of the whole file, the current todo-file must be set from todo-global-current-todo-file. * test/lisp/calendar/todo-mode-tests.el (todo-test-current-file-in-edit-mode): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/calendar/todo-mode-tests.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/calendar/todo-mode-tests.el b/test/lisp/calendar/todo-mode-tests.el
index 90282045062..6cd2bfe35b3 100644
--- a/test/lisp/calendar/todo-mode-tests.el
+++ b/test/lisp/calendar/todo-mode-tests.el
@@ -763,6 +763,29 @@ The highlighting should remain enabled."
763 (ert-simulate-command '(forward-line)) ; Now on first done item. 763 (ert-simulate-command '(forward-line)) ; Now on first done item.
764 (should (eq 'hl-line (get-char-property (point) 'face))))) 764 (should (eq 'hl-line (get-char-property (point) 'face)))))
765 765
766(ert-deftest todo-test-current-file-in-edit-mode ()
767 "Test the value of todo-current-todo-file in todo-edit-mode."
768 (with-todo-test
769 (todo-test--show 1)
770 ;; The preceding call todo-mode but does not run pre-command-hook
771 ;; in the test environment, thus failing to set
772 ;; todo-global-current-todo-file, which is needed for the test
773 ;; after todo-edit-item--text. So force the hook function to run.
774 (ert-simulate-command '(todo-mode))
775 (let ((curfile todo-current-todo-file))
776 (should (equal curfile todo-test-file-1))
777 (todo-edit-item--text 'multiline)
778 (should (equal todo-current-todo-file curfile))
779 (todo-edit-quit)
780 (todo-edit-file)
781 (should (equal todo-current-todo-file curfile))
782 (todo-edit-quit))
783 (todo-find-archive)
784 (let ((curfile todo-current-todo-file))
785 (should (equal curfile todo-test-archive-1))
786 (todo-edit-file)
787 (should (equal todo-current-todo-file curfile)))))
788
766(ert-deftest todo-test-edit-quit () 789(ert-deftest todo-test-edit-quit ()
767 "Test result of exiting todo-edit-mode on a whole file. 790 "Test result of exiting todo-edit-mode on a whole file.
768Exiting should return to the same todo-mode or todo-archive-mode 791Exiting should return to the same todo-mode or todo-archive-mode