mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Comments: Don't show the filter/pagination actions if there are no comments to list.
It doesn't make sense to be able to filter the comments list table when there are are no (trashed/spam) comments available. Fixes #40188. Props swissspidy, Jim_Panse, menakas, akbarhusen429, dinhtungdu, birgire, SergeyBiryukov, davidbaumwald, rebasaurus, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@48521 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -281,6 +281,64 @@ class Tests_Admin_includesListTable extends WP_UnitTestCase {
|
||||
$this->assertNotContains( 'id="delete_all"', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 40188
|
||||
*/
|
||||
public function test_filter_button_should_not_be_shown_if_there_are_no_comments() {
|
||||
$table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
||||
|
||||
ob_start();
|
||||
$table->extra_tablenav( 'top' );
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertNotContains( 'id="post-query-submit"', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 40188
|
||||
*/
|
||||
public function test_filter_button_should_be_shown_if_there_are_comments() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$comment_id = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => $post_id,
|
||||
'comment_approved' => '1',
|
||||
)
|
||||
);
|
||||
|
||||
$table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
||||
$table->prepare_items();
|
||||
|
||||
ob_start();
|
||||
$table->extra_tablenav( 'top' );
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertContains( 'id="post-query-submit"', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 40188
|
||||
*/
|
||||
public function test_filter_comment_status_dropdown_should_be_shown_if_there_are_comments() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$comment_id = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => $post_id,
|
||||
'comment_approved' => '1',
|
||||
)
|
||||
);
|
||||
|
||||
$table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
|
||||
$table->prepare_items();
|
||||
|
||||
ob_start();
|
||||
$table->extra_tablenav( 'top' );
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertContains( 'id="filter-by-comment-type"', $output );
|
||||
$this->assertContains( "<option value='comment'>", $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 38341
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user