mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
List Tables: Hide 'Empty Trash' and 'Empty Spam' buttons when view is already empty.
Props ivantedja, Presskopp, printsachen1, Jaydeep Rami, mathieuhays, cazm. Fixes #38341. git-svn-id: https://develop.svn.wordpress.org/trunk@40297 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -235,4 +235,31 @@ class Tests_Admin_includesListTable extends WP_UnitTestCase {
|
||||
|
||||
$this->assertNotContains( 'id="cat"', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 38341
|
||||
*/
|
||||
public function test_empty_trash_button_should_not_be_shown_if_there_are_no_posts() {
|
||||
// Set post type to a non-existent one.
|
||||
$this->table->screen->post_type = 'foo';
|
||||
|
||||
ob_start();
|
||||
$this->table->extra_tablenav( 'top' );
|
||||
$output = ob_get_clean();
|
||||
|
||||
$this->assertNotContains( 'id="delete_all"', $output );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 38341
|
||||
*/
|
||||
public function test_empty_trash_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="delete_all"', $output );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user