plone.outputfilters/master: update tests and caption template, to reflect changes in Por
MrTango <jenkins-z4DKO/[email protected]> Fri, 28 Jul 2017 04:26:47 -0700 (PDT)
| Newsgroups | gmane.comp.web.zope.plone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Repository: plone.outputfilters Branch: refs/heads/master Date: 2017-07-07T15:25:24+03:00 Author: MrTango (MrTango) <md-r4/[email protected]> Commit: https://github.com/plone/plone.outputfilters/commit/69b7d0b6624fe1eb892a1d63d7cfb6b2b5699e03 update tests and caption template, to reflect changes in PortalTransform Files changed: M plone/outputfilters/browser/captioned_image.pt M plone/outputfilters/tests/test_resolveuid_and_caption.py 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 d9afe55..f9b43f1 100644 --- a/plone/outputfilters/tests/test_resolveuid_and_caption.py +++ b/plone/outputfilters/tests/test_resolveuid_and_caption.py @@ -273,7 +273,8 @@ def test_image_captioning_in_news_item(self): 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">My caption</dd> -</dl></span>""") +</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) @@ -313,39 +314,39 @@ def test_image_captioning_relative_path_private_folder(self): text_in = """<img class="captioned" src="private/image.jpg"/>""" 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">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