Media: After [42693], update HTML4 markup in img_caption_shortcode()
to avoid an empty ID attribute as well.
Add a unit test for `aria-describedby` in `img_caption_shortcode()`. See #34595. git-svn-id: https://develop.svn.wordpress.org/trunk@42694 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bff366759c
commit
0711e585fb
@ -1623,7 +1623,7 @@ function img_caption_shortcode( $attr, $content = null ) {
|
||||
esc_attr( $class ),
|
||||
str_replace( '<img ', '<img ' . $describedby, do_shortcode( $content ) ),
|
||||
sprintf(
|
||||
'<p id="%s" class="wp-caption-text">%s</p>',
|
||||
'<p %sclass="wp-caption-text">%s</p>',
|
||||
$atts['caption_id'],
|
||||
$atts['caption']
|
||||
)
|
||||
|
@ -214,6 +214,21 @@ CAP;
|
||||
$this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 34595
|
||||
*/
|
||||
function test_img_caption_shortcode_has_aria_describedby() {
|
||||
$result = img_caption_shortcode(
|
||||
array(
|
||||
'width' => 20,
|
||||
'id' => 'myId',
|
||||
),
|
||||
$this->img_content . $this->html_content
|
||||
);
|
||||
|
||||
$this->assertEquals( 1, preg_match_all( '/aria-describedby="caption-myId"/', $result, $_r ) );
|
||||
}
|
||||
|
||||
function test_add_remove_oembed_provider() {
|
||||
wp_oembed_add_provider( 'http://foo.bar/*', 'http://foo.bar/oembed' );
|
||||
$this->assertTrue( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
|
||||
|
Loading…
Reference in New Issue
Block a user