diff options
| author | ahmedasar00 <ahmdasartech@outlook.com> | 2025-12-17 23:45:21 +0200 |
|---|---|---|
| committer | Saptak Sengupta <saptak013@gmail.com> | 2025-12-22 13:47:37 +0530 |
| commit | 46eadd90c0d72d46809646521dab55ee2dff9533 (patch) | |
| tree | 94dbc69e56cf61b085a172afced476c3d1d2dbf2 /blog | |
| parent | fb6621240a80e9c0a8eea64617e86b4f57fa2959 (diff) | |
Add Markdown table support in Entry model and corresponding test case
Diffstat (limited to 'blog')
| -rw-r--r-- | blog/tests.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/blog/tests.py b/blog/tests.py index f67bc7ea..c4891e1d 100644 --- a/blog/tests.py +++ b/blog/tests.py @@ -159,6 +159,28 @@ class EntryTestCase(DateTimeMixin, TestCase): with translation.override("nn"): self.assertEqual(entry.pub_date_localized, "21. juli 2005") + def test_markdown_table_conversion(self): + body = ( + "| Framework | Language |\n" + "|-----------|----------|\n" + "| Django | Python |\n" + "| Flask | Python |" + ) + + entry = Entry.objects.create( + pub_date=self.now, + slug="markdown-table", + body=body, + content_format=ContentFormat.MARKDOWN, + ) + expected_html = ( + "<table>\n" + "<thead>\n<tr>\n<th>Framework</th>\n<th>Language</th>\n</tr>\n</thead>\n" + "<tbody>\n<tr>\n<td>Django</td>\n<td>Python</td>\n</tr>\n" + "<tr>\n<td>Flask</td>\n<td>Python</td>\n</tr>\n</tbody>\n</table>" + ) + self.assertInHTML(expected_html, entry.body_html) + class EventTestCase(DateTimeMixin, TestCase): def test_manager_past_future(self): |
