Toolbar: Add a 'View Posts' link to the toolbar when on the post listing screen.

This adds a new link to visit the post type archive if the post type supports it. Also introduces a new `view_items` label to `get_post_type_labels()`.

Props paulwilde, akibjorklund, swissspidy.
Fixes #34113.

git-svn-id: https://develop.svn.wordpress.org/trunk@38634 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2016-09-20 20:01:55 +00:00
parent debaea8a7c
commit acb43ecc0b
3 changed files with 41 additions and 0 deletions

View File

@@ -380,4 +380,31 @@ class Tests_AdminBar extends WP_UnitTestCase {
$this->assertNull( $node_edit );
}
/**
* @ticket 34113
*/
public function test_admin_bar_contains_view_archive_link() {
set_current_screen( 'edit-post' );
$wp_admin_bar = $this->get_standard_admin_bar();
$node = $wp_admin_bar->get_node( 'archive' );
set_current_screen( 'front' );
$this->assertNotNull( $node );
}
/**
* @ticket 34113
*/
public function test_admin_bar_has_no_archives_link_for_post_types_without_archive() {
set_current_screen( 'edit-page' );
$wp_admin_bar = $this->get_standard_admin_bar();
$node = $wp_admin_bar->get_node( 'archive' );
set_current_screen( 'front' );
$this->assertNull( $node );
}
}