aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/conversion_tests.py19
-rw-r--r--tests/docx/body_xml_tests.py1
-rw-r--r--tests/styles/parser/document_matcher_parser_tests.py9
3 files changed, 28 insertions, 1 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py
index 878c804..c4e667f 100644
--- a/tests/conversion_tests.py
+++ b/tests/conversion_tests.py
@@ -231,6 +231,25 @@ def strikethrough_runs_can_be_configured_with_style_mapping():
@istest
+def sml_caps_runs_are_ignored_by_default():
+ result = convert_document_element_to_html(
+ documents.run(children=[documents.text("Hello")], is_all_caps=True),
+ )
+ assert_equal("Hello", result.value)
+
+
+@istest
+def all_caps_runs_can_be_mapped_using_style_mapping():
+ result = convert_document_element_to_html(
+ documents.run(children=[documents.text("Hello")], is_all_caps=True),
+ style_map=[
+ _style_mapping("all-caps => span")
+ ]
+ )
+ assert_equal("<span>Hello</span>", result.value)
+
+
+@istest
def small_caps_runs_are_ignored_by_default():
result = convert_document_element_to_html(
documents.run(children=[documents.text("Hello")], is_small_caps=True),
diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py
index 746259c..20f89a9 100644
--- a/tests/docx/body_xml_tests.py
+++ b/tests/docx/body_xml_tests.py
@@ -301,6 +301,7 @@ class RunTests(object):
param(attr_name="is_underline", tag_name="w:u"),
param(attr_name="is_italic", tag_name="w:i"),
param(attr_name="is_strikethrough", tag_name="w:strike"),
+ param(attr_name="is_all_caps", tag_name="w:caps"),
param(attr_name="is_small_caps", tag_name="w:smallCaps"),
])(istest(func))
diff --git a/tests/styles/parser/document_matcher_parser_tests.py b/tests/styles/parser/document_matcher_parser_tests.py
index dc93941..18233d2 100644
--- a/tests/styles/parser/document_matcher_parser_tests.py
+++ b/tests/styles/parser/document_matcher_parser_tests.py
@@ -151,6 +151,13 @@ def reads_strikethrough():
)
@istest
+def reads_all_caps():
+ assert_equal(
+ document_matchers.all_caps,
+ read_document_matcher("all-caps")
+ )
+
+@istest
def reads_small_caps():
assert_equal(
document_matchers.small_caps,
@@ -190,7 +197,7 @@ def reads_column_breaks():
def unrecognised_break_type_raises_error():
error = assert_raises(LineParseError, lambda: read_document_matcher("br[type='unknownBreakType']"))
assert_equal("Unrecognised break type: unknownBreakType", str(error))
-
+
def read_document_matcher(string):
return parse_document_matcher(TokenIterator(tokenise(string)))