Skip to content

Commit

Permalink
Improve compatibility for inline alignment of table cells with variou…
Browse files Browse the repository at this point in the history
…s email clients (collective#43)

* Inline alignment to improve compatibility with various email clients

* Fix tests
  • Loading branch information
JeffersonBledsoe authored Jan 9, 2024
1 parent 4edbe86 commit ebb70e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
<caption i18n:translate="send_mail_text_table">Form submission data for ${title}</caption>
<thead>
<tr role="row">
<th scope="col"
<th align="left"
scope="col"
role="columnheader">Field</th>
<th scope="col"
<th align="left"
scope="col"
role="columnheader">Value</th>
</tr>
</thead>
Expand All @@ -23,9 +25,10 @@
<tr role="row"
tal:define="value field/value|nothing;
label field/label|nothing">
<th scope="row"
<th align="left"
scope="row"
role="rowheader">${label}</th>
<td>${value}</td>
<td align="left">${value}</td>
</tr>
</tal:field>
</tbody>
Expand Down
12 changes: 6 additions & 6 deletions src/collective/volto/formsupport/tests/test_send_action_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,25 +743,25 @@ def test_email_body_formated_as_table(
self.assertIn(
"""<thead>
<tr role="row">
<th scope="col" role="columnheader">Field</th>
<th scope="col" role="columnheader">Value</th>
<th align="left" scope="col" role="columnheader">Field</th>
<th align="left" scope="col" role="columnheader">Value</th>
</tr>
</thead>""",
msg,
)

self.assertIn(
"""<tr role="row">
<th scope="row" role="rowheader">Name</th>""",
<th align="left" scope="row" role="rowheader">Name</th>""",
msg,
)
self.assertIn(f"<td>{name}</td>", msg)
self.assertIn(f'<td align="left">{name}</td>', msg)
self.assertIn(
"""<tr role="row">
<th scope="row" role="rowheader">""",
<th align="left" scope="row" role="rowheader">""",
msg,
)
self.assertIn(f"<td>{message}</td>", msg)
self.assertIn(f'<td align="left">{message}</td>', msg)

def test_email_body_formated_as_list(
self,
Expand Down

0 comments on commit ebb70e5

Please sign in to comment.