notmuch/test/emacs-show
Dmitry Kurochkin 8281430558 emacs: fix `notmuch-wash-region-to-button' to work at beginning of buffer
`Notmuch-wash-region-to-button' is the function that creates hidden
regions with buttons for signatures, citations and original messages.
Before the change, it did not work correctly if the to-be-hidden
region started at the beginning of a message: the visibility toggle
button was hidden as well.  The patch fixes this.  There are two parts
in the fix:

* Use `insert-before-markers' instead of `insert' for creating the
  button, so that it does not get added to the hidden overlay.

* Stop using PREFIX argument for adding a newline before the button.
  The newline should not be added before a button at the beginning of
  buffer.

The corresponding test is fixed now.
2012-02-04 07:33:18 -05:00

27 lines
820 B
Bash
Executable file

#!/usr/bin/env bash
test_description="Testing emacs notmuch-show view"
. test-lib.sh
test_begin_subtest "Hiding Original Message region at beginning of a message"
message_id='OriginalMessageHiding.1@notmuchmail.org'
add_message \
[id]="$message_id" \
'[subject]="Hiding Original Message region at beginning of a message"' \
'[body]="-----Original Message-----
Text here."'
cat <<EOF >EXPECTED
Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
Subject: Hiding Original Message region at beginning of a message
To: Notmuch Test Suite <test_suite@notmuchmail.org>
Date: Fri, 05 Jan 2001 15:43:57 +0000
[ 2-line hidden original message. Click/Enter to show. ]
EOF
test_emacs "(notmuch-show \"id:$message_id\")
(test-visible-output)"
test_expect_equal_file OUTPUT EXPECTED
test_done