Skip to content

Commit 7715041

Browse files
author
Jason Ward
committed
refs #24: added a test showing that certain lists generate invalid html. Also updated the justification test case to generate valid html as well.
1 parent 902f1b5 commit 7715041

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

pydocx/tests/test_docx.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,13 +750,13 @@ def test_justification():
750750
assert_html_equal(actual_html, '''
751751
<html><body><p><div class='center'>Center Justified</div>
752752
</p><p><div class='right'>Right justified</div></p>
753-
<p><div class='right' style ='margin-right:96.0px;'>
753+
<p><div class='right' style='margin-right:96.0px;'>
754754
Right justified and pushed in from right</div></p>
755-
<p><div class='center' style ='margin-left:252.0px;'margin-right:96.0px;'>
755+
<p><div class='center' style='margin-left:252.0px;margin-right:96.0px;'>
756756
Center justified and pushed in from left and it is
757757
great and it is the coolest thing of all time and I like it and
758758
I think it is cool</div></p><p>
759-
<div' style ='margin-left:252.0px;'margin-right:96.0px;'>
759+
<div style='margin-left:252.0px;margin-right:96.0px;'>
760760
Left justified and pushed in from left</div></p></body></html>
761761
''')
762762

pydocx/tests/test_xml.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,3 +716,31 @@ def get_xml(self):
716716

717717
xml = DXB.xml(body)
718718
return xml
719+
720+
721+
class TestCase(_TranslationTestCase):
722+
expected_output = '''
723+
<html><body>
724+
<ol data-list-type="lower-alpha">
725+
<li>AAA</li>
726+
</ol>
727+
<p>BBB</p>
728+
</body></html>
729+
'''
730+
731+
numbering_dict = {
732+
'1': {
733+
'0': 'lowerLetter',
734+
}
735+
}
736+
737+
def get_xml(self):
738+
li = DXB.li(text='AAA', ilvl=0, numId=1)
739+
p_tags = [
740+
DXB.p_tag('BBB'),
741+
]
742+
body = li
743+
for p_tag in p_tags:
744+
body += p_tag
745+
xml = DXB.xml(body)
746+
return xml

0 commit comments

Comments
 (0)