emacs-emojify

fork of https://github.com/iqbalansari/emacs-emojify
Log | Files | Refs | LICENSE

commit 6ef5a146cf8ca8732e7ca5e06607593a6a616d93
parent b19a69c6d40257145d9a65ef121439b18168c7ba
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date:   Sun, 18 Sep 2016 14:50:35 +0530

Force redisplays for after-change tests

Diffstat:
Mtest/emojify-test.el | 5+++--
Mtest/test-helper.el | 10+++-------
2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/test/emojify-test.el b/test/emojify-test.el @@ -96,8 +96,8 @@ :tags '(core after-change) (emojify-tests-with-emojified-buffer ":smile:\n:)" (emacs-lisp-mode) - (emojify-redisplay-emojis-in-region) (emojify-mode +1) + (emojify-redisplay-emojis-in-region) (emojify-tests-should-not-be-emojified (line-beginning-position)) (emojify-tests-should-not-be-emojified (line-beginning-position 2)) @@ -111,17 +111,18 @@ (emojify-tests-should-not-be-emojified (line-beginning-position)) (emojify-tests-should-not-be-emojified (line-beginning-position 2)))) +;; TODO: For some reason this test fails when run alone :/ (ert-deftest emojify-tests-emojifying-on-typing () :tags '(core after-change) (emojify-tests-with-emojified-buffer "" (emacs-lisp-mode) - (emojify-redisplay-emojis-in-region) (emojify-mode +1) (emojify-insert-string "; :)") (emojify-redisplay) (emojify-tests-should-be-emojified 4) (newline) (emojify-insert-string "; :smile") + (emojify-redisplay) (emojify-tests-should-not-be-emojified (+ 4 (line-beginning-position))) (emojify-insert-string ":") (emojify-redisplay) diff --git a/test/test-helper.el b/test/test-helper.el @@ -158,17 +158,13 @@ All kinds of dynamic behaviour on buffer are disabled. See (defun emojify-insert-string (string) "Insert the STRING." (mapc (lambda (character) - (insert character)) + (let ((last-command-event character)) + (self-insert-command 1))) (string-to-vector string))) (defun emojify-redisplay () "Trigger a redisplay." - (if noninteractive - ;; In noninteractive mode JIT is not called - ;; call it - (jit-lock-fontify-now) - ;; In interactive mode just force redisplay - (redisplay t))) + (jit-lock-fontify-now)) (provide 'test-helper) ;;; test-helper.el ends here