aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorH Durer <h.duerer@gmail.com>2018-03-10 06:04:13 +0000
committerJohnson Denen <johnson.denen@gmail.com>2018-08-10 22:20:04 -0400
commit1e7882a709ac1d67b2ff1ec17577637b70571b6a (patch)
treeacd9c1c68b67829f702ee14b7c4355706ae69513 /test
parent967d2835da2a77a0f4935a2392f667e0330608c8 (diff)
Support toggling content warning anywhere in the toot. (#180)
This new functionality is bound to the 'c' key. To help with this functionality this also changes the 'toot-json and 'toot-id properties. These are now applied to the whole toot not just the toot's byline.
Diffstat (limited to 'test')
-rw-r--r--test/mastodon-tl-tests.el21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el
index 04f00e5..1a10614 100644
--- a/test/mastodon-tl-tests.el
+++ b/test/mastodon-tl-tests.el
@@ -817,6 +817,10 @@ constant."
(mastodon-tl--spoiler normal-toot-with-spoiler)))
(setq toot-end (point))
(insert "\nsome more text.")
+ (add-text-properties
+ toot-start toot-end
+ (list 'toot-json normal-toot-with-spoiler
+ 'toot-id (cdr (assoc 'id normal-toot-with-spoiler))))
(goto-char toot-start)
(should (eq t (looking-at "This is the spoiler warning text")))
@@ -843,7 +847,22 @@ constant."
(mastodon-tl--do-link-action-at-point (car link-region))
;; The body is invisible again:
- (should (eq t (get-text-property body-position 'invisible))))))
+ (should (eq t (get-text-property body-position 'invisible)))
+
+ ;; Go back to the toot's beginning
+ (goto-char toot-start)
+ ;; Press 'c' and the body is visible again and point hasn't changed:
+ (mastodon-tl--toggle-spoiler-text-in-toot)
+ (should (eq nil (get-text-property body-position 'invisible)))
+ (should (eq toot-start (point)))
+
+ ;; Go to the toot's end
+ (goto-char toot-end)
+ ;; Press 'c' and the body is invisible again and point hasn't changed:
+ (mastodon-tl--toggle-spoiler-text-in-toot)
+ (should (eq t (get-text-property body-position 'invisible)))
+ (should (eq toot-end (point)))
+ )))
(ert-deftest mastodon-tl--hashtag ()
"Should recognise hashtags in a toot and add the required properties to it."