plone.outputfilters/master: Merge pull request #25 from plone/midsummersprint_fix_transf
GitHub <jenkins-z4DKO/[email protected]> Fri, 28 Jul 2017 04:26:54 -0700 (PDT)
| Newsgroups | gmane.comp.web.zope.plone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Repository: plone.outputfilters Branch: refs/heads/master Date: 2017-07-28T13:26:35+02:00 Author: agitator (agitator) <[email protected]> Commit: https://github.com/plone/plone.outputfilters/commit/503be947019594c7b17193c31076182826c76c7e Merge pull request #25 from plone/midsummersprint_fix_transforms Update tests to reflect changes in PortalTransforms Files changed: M CHANGES.rst M plone/outputfilters/browser/captioned_image.pt M plone/outputfilters/tests/test_resolveuid_and_caption.py diff --git a/CHANGES.rst b/CHANGES.rst index 7e86e8b..8ed1553 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,8 +14,8 @@ New features: Bug fixes: -- *add item here* - +- update test to reflect changes in PortalTransforms + [MrTango] 3.0.2 (2017-07-03) ------------------ diff --git a/plone/outputfilters/browser/captioned_image.pt b/plone/outputfilters/browser/captioned_image.pt index d1ab6e8..3807e38 100644 --- a/plone/outputfilters/browser/captioned_image.pt +++ b/plone/outputfilters/browser/captioned_image.pt @@ -1,10 +1,8 @@ -<dl tal:attributes="style string:width:${options/width}px;;; - class options/class;"> +<dl tal:attributes="class options/class;"> <dt><a tal:omit-tag="options/isfullsize" rel="lightbox" tal:attributes="href options/url_path;" tal:content="structure options/tag">[image goes here]</a></dt> <dd class="image-caption" - tal:attributes="style string:width:${options/width}px;;;" tal:content="options/caption|nothing"> </dd> -</dl> \ No newline at end of file +</dl> diff --git a/plone/outputfilters/tests/test_resolveuid_and_caption.py b/plone/outputfilters/tests/test_resolveuid_and_caption.py index 46a0d76..f9b43f1 100644 --- a/plone/outputfilters/tests/test_resolveuid_and_caption.py +++ b/plone/outputfilters/tests/test_resolveuid_and_caption.py @@ -270,10 +270,11 @@ def test_image_captioning_in_news_item(self): # Test captioning output = news_item.text.output - self.assertRegexpMatches(output, r"""<span><dl style="width:500px;" class="captioned"> + self.assertRegexpMatches(output, r"""<span><dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/(.*?)\.jpeg" alt="Image" title="Image" height="331" width="500"( ?)/></dt> - <dd class="image-caption" style="width:500px;">My caption</dd> -</dl></span>""") + <dd class="image-caption">My caption</dd> +</dl> +</span>""") def test_image_captioning_absolutizes_uncaptioned_image(self): text_in = """<img src="/image.jpg" />""" @@ -282,17 +283,17 @@ def test_image_captioning_absolutizes_uncaptioned_image(self): def test_image_captioning_absolute_path(self): text_in = """<img class="captioned" src="/image.jpg"/>""" - text_out = """<dl style="width:500px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/...jpeg" alt="Image" title="Image" height="331" width="500" /></dt> - <dd class="image-caption" style="width:500px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_relative_path(self): text_in = """<img class="captioned" src="image.jpg"/>""" - text_out = """<dl style="width:500px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/...jpeg" alt="Image" title="Image" height="331" width="500" /></dt> - <dd class="image-caption" style="width:500px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) @@ -311,41 +312,41 @@ def test_image_captioning_relative_path_private_folder(self): self.logout() text_in = """<img class="captioned" src="private/image.jpg"/>""" - text_out = """<dl style="width:500px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/private/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="331" width="500" /></dt> - <dd class="image-caption" style="width:500px;">My private image caption</dd> + <dd class="image-caption">My private image caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_relative_path_scale(self): text_in = """<img class="captioned" src="image.jpg/@@images/image/thumb"/>""" - text_out = """<dl style="width:128px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><a rel="lightbox" href="/plone/image.jpg"><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="84" width="128" /></a></dt> - <dd class="image-caption" style="width:128px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_resolveuid(self): text_in = """<img class="captioned" src="resolveuid/%s"/>""" % self.UID - text_out = """<dl style="width:500px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="331" width="500" /></dt> - <dd class="image-caption" style="width:500px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_resolveuid_scale(self): text_in = """<img class="captioned" src="resolveuid/%s/@@images/image/thumb"/>""" % self.UID - text_out = """<dl style="width:128px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><a rel="lightbox" href="/plone/image.jpg"><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="84" width="128" /></a></dt> - <dd class="image-caption" style="width:128px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_resolveuid_new_scale(self): text_in = """<img class="captioned" src="resolveuid/%s/@@images/image/thumb"/>""" % self.UID - text_out = """<dl style="width:128px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><a rel="lightbox" href="/plone/image.jpg"><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="84" width="128" /></a></dt> - <dd class="image-caption" style="width:128px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) @@ -359,9 +360,9 @@ def test_image_captioning_resolveuid_new_scale_plone_namedfile(self): def test_image_captioning_resolveuid_no_scale(self): text_in = """<img class="captioned" src="resolveuid/%s/@@images/image"/>""" % self.UID - text_out = """<dl style="width:500px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="331" width="500" /></dt> -<dd class="image-caption" style="width:500px;">My caption</dd> +<dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) @@ -391,27 +392,26 @@ def test_image_captioning_external_url(self): def test_image_captioning_preserves_custom_attributes(self): text_in = """<img class="captioned" width="42" height="42" foo="bar" src="image.jpg"/>""" - text_out = """<dl style="width:42px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="42" width="42" foo="bar" /></dt> - <dd class="image-caption" style="width:42px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_handles_unquoted_attributes(self): text_in = """<img class=captioned height=144 alt="picture alt text" src="resolveuid/%s" width=120 />""" % self.UID - text_out = """<dl style="width:120px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="picture alt text" title="Image" height="144" width="120" /></dt> - <dd class="image-caption" style="width:120px;">My caption</dd> + <dd class="image-caption">My caption</dd> </dl>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_preserves_existing_links(self): text_in = """<a href="/xyzzy" class="link"><img class="image-left captioned" src="image.jpg/@@images/image/thumb"/></a>""" - text_out = """<a href="/xyzzy" class="link"><dl style="width:128px;" class="image-left captioned"> + text_out = """<a href="/xyzzy" class="link"><dl class="image-left captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/....jpeg" alt="Image" title="Image" height="84" width="128" /></dt> - <dd class="image-caption" style="width:128px;">My caption</dd> -</dl> -</a>""" + <dd class="image-caption">My caption</dd> +</dl></a>""" self._assertTransformsTo(text_in, text_out) def test_image_captioning_handles_non_ascii(self): @@ -419,9 +419,9 @@ def test_image_captioning_handles_non_ascii(self): self.portal['image.jpg'].setDescription( u'Kupu Test Image \xe5\xe4\xf6') text_in = """<img class="captioned" src="image.jpg"/>""" - text_out = """<dl style="width:500px;" class="captioned"> + text_out = """<dl class="captioned"> <dt><img src="http://nohost/plone/image.jpg/@@images/...jpeg" alt="Kupu Test Image \xc3\xa5\xc3\xa4\xc3\xb6" title="Kupu Test Image \xc3\xa5\xc3\xa4\xc3\xb6" height="331" width="500" /></dt> - <dd class="image-caption" style="width:500px;">Kupu Test Image \xc3\xa5\xc3\xa4\xc3\xb6</dd> + <dd class="image-caption">Kupu Test Image \xc3\xa5\xc3\xa4\xc3\xb6</dd> </dl>""" self._assertTransformsTo(text_in, text_out) ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot