diff options
| author | Michael Williamson <mike@zwobble.org> | 2017-11-04 11:25:51 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2017-11-04 11:25:51 +0000 |
| commit | ade2f7706813d785345563c57e7baf902ea2a7f4 (patch) | |
| tree | 5003acc0e03415dbe3eb71e2f35cbd8285661975 /tests | |
| parent | 1498397f4ede71d81ec79f380d43ec041438a047 (diff) | |
Add style mappings for tables
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conversion_tests.py | 13 | ||||
| -rw-r--r-- | tests/styles/parser/document_matcher_parser_tests.py | 25 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py index 38aa1a8..a2b1a0b 100644 --- a/tests/conversion_tests.py +++ b/tests/conversion_tests.py @@ -348,6 +348,19 @@ def docx_table_is_converted_to_table_in_html(): @istest +def table_style_mappings_can_be_used_to_map_tables(): + table = documents.table([], style_name="Normal Table") + result = convert_document_element_to_html( + table, + style_map=[ + _style_mapping("table[style-name='Normal Table'] => table.normal-table:fresh"), + ], + ) + expected_html = '<table class="normal-table"></table>' + assert_equal(expected_html, result.value) + + +@istest def header_rows_are_wrapped_in_thead(): table = documents.table([ documents.table_row([documents.table_cell([])], is_header=True), diff --git a/tests/styles/parser/document_matcher_parser_tests.py b/tests/styles/parser/document_matcher_parser_tests.py index 62f3181..dc93941 100644 --- a/tests/styles/parser/document_matcher_parser_tests.py +++ b/tests/styles/parser/document_matcher_parser_tests.py @@ -97,6 +97,31 @@ def reads_run_with_style_name(): read_document_matcher("r[style-name='Emphasis']") ) + +@istest +def reads_plain_table(): + assert_equal( + document_matchers.table(), + read_document_matcher("table") + ) + + +@istest +def reads_table_with_style_id(): + assert_equal( + document_matchers.table(style_id="TableNormal"), + read_document_matcher("table.TableNormal") + ) + + +@istest +def reads_table_with_style_name(): + assert_equal( + document_matchers.table(style_name=document_matchers.equal_to("Normal Table")), + read_document_matcher("table[style-name='Normal Table']") + ) + + @istest def reads_bold(): assert_equal( |
