aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/conversion_tests.py11
-rw-r--r--tests/mammoth_tests.py7
-rw-r--r--tests/style_reader_tests.py7
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py
index 1563131..23e61d4 100644
--- a/tests/conversion_tests.py
+++ b/tests/conversion_tests.py
@@ -211,6 +211,17 @@ def strikethrough_runs_are_wrapped_in_s_elements_by_default():
@istest
+def strikethrough_runs_can_be_configured_with_style_mapping():
+ result = convert_document_element_to_html(
+ documents.run(children=[documents.text("Hello")], is_strikethrough=True),
+ style_map=[
+ style_reader.read_style("strike => del")
+ ]
+ )
+ assert_equal("<del>Hello</del>", result.value)
+
+
+@istest
def superscript_runs_are_wrapped_in_sup_tags():
result = convert_document_element_to_html(
documents.run(
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py
index 84cb6ea..9f37db0 100644
--- a/tests/mammoth_tests.py
+++ b/tests/mammoth_tests.py
@@ -138,6 +138,13 @@ def strikethrough_is_converted_to_s_element_by_default():
@istest
+def strikethrough_conversion_can_be_configured_with_style_mapping():
+ with open(test_path("strikethrough.docx"), "rb") as fileobj:
+ result = mammoth.convert_to_html(fileobj=fileobj, style_map="strike => del")
+ assert_equal("<p><del>Today's Special: Salmon</del> Sold out</p>", result.value)
+
+
+@istest
def transform_document_is_applied_to_document_before_conversion():
def transform_document(document):
document.children[0].style_id = "Heading1"
diff --git a/tests/style_reader_tests.py b/tests/style_reader_tests.py
index 501629a..52d66fd 100644
--- a/tests/style_reader_tests.py
+++ b/tests/style_reader_tests.py
@@ -141,6 +141,13 @@ class ReadDocumentMatcherTests(object):
read_document_matcher("u")
)
+ @istest
+ def reads_strikethrough(self):
+ assert_equal(
+ document_matchers.strikethrough,
+ read_document_matcher("strike")
+ )
+
@istest
def document_matcher_is_mapped_to_html_path_using_fat_arrow():