[wp-trac] [WordPress Trac] #33981: Default Captions Should Use max-width
WordPress Trac
noreply at wordpress.org
Thu Sep 28 02:54:33 UTC 2017
#33981: Default Captions Should Use max-width
--------------------------------------------------+------------------------
Reporter: Howdy_McGee | Owner: joemcgill
Type: enhancement | Status: assigned
Priority: normal | Milestone: 4.9
Component: Media | Version: 4.3.1
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd-opinion | Focuses: ui
--------------------------------------------------+------------------------
Comment (by desrosj):
In [attachment:33981.3.patch], I made a handful of test adjustments:
- `test_img_caption_shortcode_with_bad_attr()` was checking that two
identical strings were equal and not checking the result of the function.
It was also not passing a content parameter. I renamed this test
`test_img_caption_shortcode_with_empty_params_but_content()`.
- Added `test_img_caption_shortcode_short_circuit_filter()` to test that
the function properly returns the results of the short circuit filter.
- Added `test_img_caption_shortcode_empty_width()` to ensure that
`$content` is returned unaltered when width is `< 1`.
- Added `test_img_caption_shortcode_empty_caption()` to ensure that `null`
is returned when `$atts['caption']` is empty and no `$content` is
specified.
- Added `test_img_caption_shortcode_empty_caption_and_content()` to ensure
that `$content` is returned unaltered when `$atts['caption']` is empty.
Makes the tests for that function slightly better, but we probably could
still add some more scenarios.
One thing I thought of when diving in, could changing `width` to `max-
width` cause problems with the `img_caption_shortcode_width` filter where
someone needs the caption to be guaranteed a certain width? I think it is
possible, but I don't know if that should hold this small change back.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33981#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list