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:
Sergey Biryukov
2018-02-11 15:39:20 +00:00
parent bff366759c
commit 0711e585fb
2 changed files with 16 additions and 1 deletions

View File

@@ -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/*' ) );