mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Widgets: Omit attributes from an Image widget's link when they are empty.
Props subrataemfluence, Nenad Obradovic, westonruter. See #39993. Fixes #41919. git-svn-id: https://develop.svn.wordpress.org/trunk@41549 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -393,12 +393,10 @@ class Test_WP_Widget_Media_Image extends WP_UnitTestCase {
|
||||
|
||||
$link = '<a href="' . wp_get_attachment_url( $attachment_id ) . '"';
|
||||
$this->assertContains( $link, $output );
|
||||
$link .= ' class=""';
|
||||
$this->assertContains( $link, $output );
|
||||
$link .= ' rel=""';
|
||||
$this->assertContains( $link, $output );
|
||||
$link .= ' target=""';
|
||||
$this->assertContains( $link, $output );
|
||||
$this->assertTrue( (bool) preg_match( '#<a href.*?>#', $output, $matches ) );
|
||||
$this->assertNotContains( ' class="', $matches[0] );
|
||||
$this->assertNotContains( ' rel="', $matches[0] );
|
||||
$this->assertNotContains( ' target="', $matches[0] );
|
||||
|
||||
ob_start();
|
||||
$widget->render_media( array(
|
||||
@@ -413,7 +411,7 @@ class Test_WP_Widget_Media_Image extends WP_UnitTestCase {
|
||||
$this->assertContains( '<a href="' . get_attachment_link( $attachment_id ) . '"', $output );
|
||||
$this->assertContains( 'class="custom-link-class"', $output );
|
||||
$this->assertContains( 'rel="attachment"', $output );
|
||||
$this->assertContains( 'target=""', $output );
|
||||
$this->assertNotContains( 'target=""', $output );
|
||||
|
||||
ob_start();
|
||||
$widget->render_media( array(
|
||||
|
||||
Reference in New Issue
Block a user