~netlandish/django-wiki

90a99b59cac626f3365ef9d3326f9d049a0d6930 — Benjamin Bach 6 years ago 509017d
Adding some tests for captions
1 files changed, 13 insertions(+), 0 deletions(-)

M tests/plugins/images/test_markdown.py
M tests/plugins/images/test_markdown.py => tests/plugins/images/test_markdown.py +13 -0
@@ 18,10 18,23 @@ class ImageMarkdownTests(RequireRootArticleMixin, TestBase):
        self.assertNotIn("[image:1 align:left]", md_text)
        md_text = md.convert("image: [image:1 align:left]\nadasd")
        self.assertIn("<figure", md_text)
        self.assertNotIn("<caption", md_text)
        md_text = md.convert("image: [image:1 align:right size:medium]\nadasd")
        self.assertIn("<figure", md_text)
        self.assertNotIn("<caption", md_text)
        md_text = md.convert("image: [image:123 align:left size:medium]\nadasd")
        self.assertIn("Image not found", md_text)
        self.assertNotIn("<caption", md_text)

    def test_caption(self):
        md = markdown.ArticleMarkdown(article=self.root_article)
        md_text = md.convert("[image:1 align:left]\n    this is visual")
        self.assertIn("<figure", md_text)
        self.assertIn("<caption", md_text)
        md = markdown.ArticleMarkdown(article=self.root_article)
        md_text = md.convert("[image:1 align:left]\n    this is visual\n    second line")
        self.assertIn("<figure", md_text)
        self.assertIn("<caption>this is visual\nsecond line</caption>", md_text)

    def test_escape(self):
        md = markdown.ArticleMarkdown(article=self.root_article)