mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Widgets: When using the_widget(), the $before_widget argument only receives the widget class if using the default sidebar arguments. Run sprintf after parsing the args to fix this.
Adds unit test. Props coffee2code. Fixes #19450. git-svn-id: https://develop.svn.wordpress.org/trunk@35106 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -607,4 +607,19 @@ class Tests_Widgets extends WP_UnitTestCase {
|
||||
$this->assertContains( $contained, $control );
|
||||
}
|
||||
}
|
||||
|
||||
function test_the_widget_custom_before_title_arg() {
|
||||
|
||||
ob_start();
|
||||
the_widget(
|
||||
'WP_Widget_Text',
|
||||
array( 'title' => 'Notes', 'text' => 'Sample text' ),
|
||||
array( 'before_widget' => '<span class="special %s">', 'after_widget' => '</span>' )
|
||||
);
|
||||
$actual = ob_get_clean();
|
||||
|
||||
$this->assertRegExp( '/<span class="special widget_text">/', $actual );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user