mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Comments: Ensure that themes overriding default comment_form() fields still display the cookies consent checkbox.
The `comment_form_default_fields` filter can be used to remove the checkbox. Props pross, SergeyBiryukov. Fixes #44126. git-svn-id: https://develop.svn.wordpress.org/trunk@43518 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -80,4 +80,24 @@ class Tests_Comment_CommentForm extends WP_UnitTestCase {
|
||||
unset( $defaults['submit_button'] );
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 44126
|
||||
*/
|
||||
public function test_fields_should_include_cookies_consent() {
|
||||
$p = self::factory()->post->create();
|
||||
|
||||
add_filter( 'option_show_comments_cookies_opt_in', '__return_true' );
|
||||
|
||||
$args = array(
|
||||
'fields' => array(
|
||||
'author' => 'Hello World!',
|
||||
),
|
||||
);
|
||||
$form = get_echo( 'comment_form', array( $args, $p ) );
|
||||
|
||||
remove_filter( 'option_show_comments_cookies_opt_in', '__return_true' );
|
||||
|
||||
$this->assertRegExp( '|<p class="comment\-form\-cookies\-consent">.*?</p>|', $form );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user