diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 2429ab3adb776..f0fff82ad1296 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -1230,10 +1230,10 @@ function wp_dropdown_pages( $args = '' ) { $output = "\n"; diff --git a/tests/phpunit/tests/post/wpDropdownPages.php b/tests/phpunit/tests/post/wpDropdownPages.php index d838875f1d315..60dc95f99b9c4 100644 --- a/tests/phpunit/tests/post/wpDropdownPages.php +++ b/tests/phpunit/tests/post/wpDropdownPages.php @@ -219,4 +219,53 @@ public function test_wp_dropdown_pages_should_obey_class_parameter() { $this->assertMatchesRegularExpression( '/]+class=\'bar\'/', $found ); } + + /** + * Tests that the 'show_option_none' option can be selected. + * + * @ticket 65510 + */ + public function test_wp_dropdown_pages_show_option_none_is_selected() { + self::factory()->post->create( + array( + 'post_type' => 'page', + 'post_name' => 'foo', + ) + ); + + $found = wp_dropdown_pages( + array( + 'echo' => 0, + 'show_option_none' => 'None', + 'option_none_value' => 'none_value', + 'selected' => 'none_value', + ) + ); + + $this->assertStringContainsString( '', $found ); + } + + /** + * Tests that the 'show_option_no_change' option can be selected. + * + * @ticket 65510 + */ + public function test_wp_dropdown_pages_show_option_no_change_is_selected() { + self::factory()->post->create( + array( + 'post_type' => 'page', + 'post_name' => 'foo', + ) + ); + + $found = wp_dropdown_pages( + array( + 'echo' => 0, + 'show_option_no_change' => 'No Change', + 'selected' => '-1', + ) + ); + + $this->assertStringContainsString( '', $found ); + } }