From 1e7882a709ac1d67b2ff1ec17577637b70571b6a Mon Sep 17 00:00:00 2001 From: H Durer Date: Sat, 10 Mar 2018 06:04:13 +0000 Subject: 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. --- test/mastodon-tl-tests.el | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test') 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." -- cgit v1.2.3