-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle case when image has no wrapper tag
- Loading branch information
Showing
3 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/collective/facebook/instantarticles/tests/test_instant_article_view.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Viewlet tests for this package.""" | ||
from collective.facebook.instantarticles.browser.viewlets import ( | ||
FacebookInstantArticlesViewlet, | ||
) # NOQA | ||
from collective.facebook.instantarticles.interfaces import ( | ||
IInstantArticlesSettings, | ||
) # NOQA | ||
from collective.facebook.instantarticles.testing import ( | ||
COLLECTIVE_FACEBOOK_INSTANTARTICLES_INTEGRATION_TESTING, | ||
) # NOQA | ||
from plone import api | ||
|
||
import unittest | ||
|
||
|
||
class TestInstantArticleView(unittest.TestCase): | ||
""" | ||
Test support view | ||
""" | ||
|
||
layer = COLLECTIVE_FACEBOOK_INSTANTARTICLES_INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
"""Custom shared utility setup for tests.""" | ||
self.portal = self.layer['portal'] | ||
self.request = self.portal.REQUEST | ||
|
||
def testFixText(self): | ||
view = api.content.get_view( | ||
name='instant_article', context=self.portal, request=self.request | ||
) | ||
img_tag = '<img src="something" />' | ||
img_inside_p = '<p><img src="something" /> Example.</p>' | ||
self.assertEqual( | ||
view.fixText(img_tag), '<div><img src="something"></div>' | ||
) | ||
self.assertEqual( | ||
view.fixText(img_inside_p), | ||
'<div><img src="something"><p> Example.</p></div>', | ||
) | ||
|