mirror of
git://develop.git.wordpress.org/
synced 2025-03-14 17:09:47 +01:00
General: Fix 'rel'
argument in Tests_Functions_wpListBookmarks
test datasets.
`wp_list_bookmarks()` arguments include `'link_rel'`, but not `'rel'`. This commit fixes this argument in the test datasets. It also adds an expected `'rel=""'` result check, i.e. instead of only checking for `'noopener'`. Follow-up to [52395]. Props davidbinda. Fixes #53839. git-svn-id: https://develop.svn.wordpress.org/trunk@52396 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b3b302df31
commit
3ce5c4c5a8
@ -15,11 +15,12 @@ class Tests_Functions_wpListBookmarks extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 53839
|
||||
*
|
||||
* @param array $args The arguments to create the bookmark.
|
||||
* @param array $args The arguments to create the bookmark.
|
||||
* @param string $expected Expected string to test.
|
||||
*/
|
||||
public function test_wp_list_bookmarks_adds_noopener( $args ) {
|
||||
$bookmark = self::factory()->bookmark->create( $args );
|
||||
$this->assertStringContainsString( 'noopener', wp_list_bookmarks( 'echo=0' ) );
|
||||
public function test_wp_list_bookmarks_adds_noopener( $args, $expected ) {
|
||||
self::factory()->bookmark->create( $args );
|
||||
$this->assertStringContainsString( $expected, wp_list_bookmarks( 'echo=0' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -30,34 +31,38 @@ class Tests_Functions_wpListBookmarks extends WP_UnitTestCase {
|
||||
public function data_wp_list_bookmarks_adds_noopener() {
|
||||
return array(
|
||||
'target as "_blank"' => array(
|
||||
'args' => array(
|
||||
'args' => array(
|
||||
'link_name' => 'With _blank',
|
||||
'link_url' => 'https://www.wordpress.org',
|
||||
'link_target' => '_blank',
|
||||
),
|
||||
'expected' => 'rel="noopener"',
|
||||
),
|
||||
'target as "_blank" and a link relationship' => array(
|
||||
'args' => array(
|
||||
'args' => array(
|
||||
'link_name' => 'With _blank and a link relationship',
|
||||
'link_url' => 'https://www.wordpress.org',
|
||||
'link_target' => '_blank',
|
||||
'rel' => 'me',
|
||||
'link_rel' => 'me',
|
||||
),
|
||||
'expected' => 'rel="me noopener"',
|
||||
),
|
||||
'target as "_top"' => array(
|
||||
'args' => array(
|
||||
'args' => array(
|
||||
'link_name' => 'With _top',
|
||||
'link_url' => 'https://www.wordpress.org',
|
||||
'link_target' => '_top',
|
||||
),
|
||||
'expected' => 'rel="noopener"',
|
||||
),
|
||||
'target as "_top" and a link relationship' => array(
|
||||
'args' => array(
|
||||
'args' => array(
|
||||
'link_name' => 'With _top and a link relationship',
|
||||
'link_url' => 'https://www.wordpress.org',
|
||||
'link_target' => '_top',
|
||||
'rel' => 'me',
|
||||
'link_rel' => 'me',
|
||||
),
|
||||
'expected' => 'rel="me noopener"',
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -72,7 +77,7 @@ class Tests_Functions_wpListBookmarks extends WP_UnitTestCase {
|
||||
* @param array $args The arguments to create the bookmark.
|
||||
*/
|
||||
public function test_wp_list_bookmarks_does_not_add_noopener( $args ) {
|
||||
$bookmark = self::factory()->bookmark->create( $args );
|
||||
self::factory()->bookmark->create( $args );
|
||||
$this->assertStringNotContainsString( 'noopener', wp_list_bookmarks( 'echo=0' ) );
|
||||
}
|
||||
|
||||
@ -95,7 +100,7 @@ class Tests_Functions_wpListBookmarks extends WP_UnitTestCase {
|
||||
'link_name' => 'With _blank and a link relationship',
|
||||
'link_url' => 'https://www.wordpress.org',
|
||||
'link_target' => '_none',
|
||||
'rel' => 'me',
|
||||
'link_rel' => 'me',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user