aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-03 14:55:21 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-03 14:55:21 +0100
commit63974a9b4d026eed3b7a8b8c0ef2278ff28c4d18 (patch)
treed1ea3a1bcd61423f20dd77345a3e9fdf82b06775 /tests
parent8059e5f4d09fb14f2109cedb63ae0d353537e6b3 (diff)
Add initial support for comments
Diffstat (limited to 'tests')
-rw-r--r--tests/conversion_tests.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py
index b045cac..300d1a9 100644
--- a/tests/conversion_tests.py
+++ b/tests/conversion_tests.py
@@ -445,6 +445,36 @@ def comments_are_ignored_by_default():
assert_equal(expected_html, result.value)
+@istest
+def comment_references_are_linked_to_comment_after_main_body():
+ reference = documents.comment_reference("4")
+ comment = documents.comment(
+ comment_id="4",
+ body=[_paragraph_with_text("Who's there?")],
+ author_name="The Piemaker",
+ author_initials="TP",
+ )
+ document = documents.document(
+ [documents.paragraph([
+ _run_with_text("Knock knock"),
+ documents.run([reference])
+ ])],
+ comments=[comment],
+ )
+ result = convert_document_element_to_html(
+ document,
+ id_prefix="doc-42-",
+ style_map=[
+ _style_mapping("comment-reference => sup")
+ ],
+ )
+ expected_html = (
+ '<p>Knock knock<sup><a href="#doc-42-comment-4" id="doc-42-comment-ref-4">[TP 1]</a></sup></p>' +
+ '<dl><dt id="doc-42-comment-4">TP 1</dt><dd><p>Who\'s there? <a href="#doc-42-comment-ref-4">↑</a></p></dd></dl>'
+ )
+ assert_equal(expected_html, result.value)
+
+
def _paragraph_with_text(text):
return documents.paragraph(children=[_run_with_text(text)])