mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Accessibility: use aria-current for the paginated post links output by wp_link_pages().
Continues the introduction in core of the aria-current attribute after [41683], [41359], and [41371]. - changes the `wp_link_pages()` (see the `nextpage` quicktag) output to use an `aria-current` attribute on the current item - adds `post-nav-links` and `post-page-numbers` CSS classes to help themes style these links - updates the related tests Props antonioeatgoat, alexstine. Fixes #41859. git-svn-id: https://develop.svn.wordpress.org/trunk@42440 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -14,16 +14,16 @@ class Tests_Post_Template extends WP_UnitTestCase {
|
||||
|
||||
setup_postdata( get_post( $post_id ) );
|
||||
|
||||
$permalink = sprintf( '<a href="%s">', get_permalink() );
|
||||
$permalink = sprintf( '<a href="%s" class="post-page-numbers">', get_permalink() );
|
||||
$page2 = _wp_link_page( 2 );
|
||||
$page3 = _wp_link_page( 3 );
|
||||
|
||||
$expected = "<p>Pages: 1 {$page2}2</a> {$page3}3</a></p>";
|
||||
$expected = '<p class="post-nav-links">Pages: <span class="post-page-numbers current" aria-current="page">1</span> ' . $page2 . '2</a> ' . $page3 . '3</a></p>';
|
||||
$output = wp_link_pages( array( 'echo' => 0 ) );
|
||||
|
||||
$this->assertEquals( $expected, $output );
|
||||
|
||||
$before_after = " 1 {$page2}2</a> {$page3}3</a>";
|
||||
$before_after = " <span class=\"post-page-numbers current\" aria-current=\"page\">1</span> {$page2}2</a> {$page3}3</a>";
|
||||
$output = wp_link_pages(
|
||||
array(
|
||||
'echo' => 0,
|
||||
@@ -34,7 +34,7 @@ class Tests_Post_Template extends WP_UnitTestCase {
|
||||
|
||||
$this->assertEquals( $before_after, $output );
|
||||
|
||||
$separator = " 1{$page2}2</a>{$page3}3</a>";
|
||||
$separator = " <span class=\"post-page-numbers current\" aria-current=\"page\">1</span>{$page2}2</a>{$page3}3</a>";
|
||||
$output = wp_link_pages(
|
||||
array(
|
||||
'echo' => 0,
|
||||
@@ -46,7 +46,7 @@ class Tests_Post_Template extends WP_UnitTestCase {
|
||||
|
||||
$this->assertEquals( $separator, $output );
|
||||
|
||||
$link = " <em>1</em>{$page2}<em>2</em></a>{$page3}<em>3</em></a>";
|
||||
$link = " <span class=\"post-page-numbers current\" aria-current=\"page\"><em>1</em></span>{$page2}<em>2</em></a>{$page3}<em>3</em></a>";
|
||||
$output = wp_link_pages(
|
||||
array(
|
||||
'echo' => 0,
|
||||
@@ -107,7 +107,7 @@ class Tests_Post_Template extends WP_UnitTestCase {
|
||||
$this->assertEquals( $next_prev_link, $output );
|
||||
|
||||
$GLOBALS['page'] = 1;
|
||||
$separator = "<p>Pages: 1 | {$page2}2</a> | {$page3}3</a></p>";
|
||||
$separator = "<p class=\"post-nav-links\">Pages: <span class=\"post-page-numbers current\" aria-current=\"page\">1</span> | {$page2}2</a> | {$page3}3</a></p>";
|
||||
$output = wp_link_pages(
|
||||
array(
|
||||
'echo' => 0,
|
||||
@@ -117,7 +117,7 @@ class Tests_Post_Template extends WP_UnitTestCase {
|
||||
|
||||
$this->assertEquals( $separator, $output );
|
||||
|
||||
$pagelink = " Page 1 | {$page2}Page 2</a> | {$page3}Page 3</a>";
|
||||
$pagelink = " <span class=\"post-page-numbers current\" aria-current=\"page\">Page 1</span> | {$page2}Page 2</a> | {$page3}Page 3</a>";
|
||||
$output = wp_link_pages(
|
||||
array(
|
||||
'echo' => 0,
|
||||
|
||||
Reference in New Issue
Block a user