Introduce class argument to wp_dropdown_pages().

This new argument allows devs to specify the 'class' attribute of the select
element.

Props ramiy, voldemortensen.
Fixes #30082.

git-svn-id: https://develop.svn.wordpress.org/trunk@32727 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-06-12 13:04:04 +00:00
parent 671218ac1d
commit dba2b6a9c0
2 changed files with 42 additions and 1 deletions
+33
View File
@@ -198,6 +198,39 @@ NO;
$this->assertContains( 'value="' . $p . '"', $found );
}
/**
* @ticket 30082
*/
public function test_wp_dropdown_pages_should_not_contain_class_attribute_when_no_class_is_passed() {
$p = $this->factory->post->create( array(
'post_type' => 'page',
'post_name' => 'foo',
) );
$found = wp_dropdown_pages( array(
'echo' => 0,
) );
$this->assertNotRegExp( '/<select[^>]+class=\'/', $found );
}
/**
* @ticket 30082
*/
public function test_wp_dropdown_pages_should_obey_class_parameter() {
$p = $this->factory->post->create( array(
'post_type' => 'page',
'post_name' => 'foo',
) );
$found = wp_dropdown_pages( array(
'echo' => 0,
'class' => 'bar',
) );
$this->assertRegExp( '/<select[^>]+class=\'bar\'/', $found );
}
/**
* @ticket 31389
*/