branch: elpa/evil-nerd-commenter
commit 72d4aacd2852df5c1e27280426b9bbff24e7a370
Author: Chen Bin <[email protected]>
Commit: Chen Bin <[email protected]>
more unit test
---
evil-nerd-commenter-tests.el | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/evil-nerd-commenter-tests.el b/evil-nerd-commenter-tests.el
index d83b64f6a6..c6f301c7c8 100644
--- a/evil-nerd-commenter-tests.el
+++ b/evil-nerd-commenter-tests.el
@@ -72,10 +72,33 @@
(js-mode)
(goto-char (point-min))
(evilnc-copy-and-comment-lines 2)
+ (should (not (evilnc-is-pure-comment (point))))
(setq lines (evilnc-get-lines (point-min) (point-max)))
(should (string= (nth 0 lines) "// hello"))
(should (string= (nth 1 lines) "// world"))
(should (string= (nth 2 lines) "hello"))
(should (string= (nth 3 lines) "world")))))
+(ert-deftest evilnc-test-comment-html-tag ()
+ (let* (lines)
+ (with-temp-buffer
+ (insert "<div class=\"box\">\nhello world\n</div>")
+ (html-mode)
+ ;; comment tag
+ (goto-char (point-min))
+ (evilnc-comment-or-uncomment-html-tag)
+ (setq lines (evilnc-get-lines (point-min) (point-max)))
+ (should (string= (nth 0 lines) "{/* <div class=\"box\">"))
+ (should (string= (nth 1 lines) "hello world"))
+ (should (string= (nth 2 lines) "</div> */}"))
+ ;; move the cursor to the middle of html tag
+ (goto-line 2)
+ ;; uncomment whole tag
+ (evilnc-comment-or-uncomment-html-tag)
+ (setq lines (evilnc-get-lines (point-min) (point-max)))
+ (should (string= (nth 0 lines) "<div class=\"box\">"))
+ (should (string= (nth 1 lines) "hello world"))
+ (should (string= (nth 2 lines) "</div>"))
+ )))
+
(ert-run-tests-batch-and-exit)