Changeset 46090
- Timestamp:
- 09/11/2019 01:50:23 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r46088 r46090 2429 2429 $args = array_merge( $defaults, $args ); 2430 2430 2431 // Remove aria-describedby from the email field if there's no associated description. 2432 if ( false === strpos( $args['comment_notes_before'], 'id="email-notes"' ) ) { 2433 $args['fields']['email'] = str_replace( 2434 ' aria-describedby="email-notes"', 2435 '', 2436 $args['fields']['email'] 2437 ); 2438 } 2439 2431 2440 /** 2432 2441 * Fires before the comment form. … … 2510 2519 endif; 2511 2520 2512 // Prepare an array of all fields, including the textarea 2521 // Prepare an array of all fields, including the textarea. 2513 2522 $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; 2514 2523 -
trunk/tests/phpunit/tests/comment/commentForm.php
r43531 r46090 14 14 'label_submit' => 'foo-label', 15 15 ); 16 16 17 $form = get_echo( 'comment_form', array( $args, $p ) ); 17 18 … … 31 32 'submit_button' => '<input name="custom-%1$s" type="submit" id="custom-%2$s" class="custom-%3$s" value="custom-%4$s" />', 32 33 ); 34 33 35 $form = get_echo( 'comment_form', array( $args, $p ) ); 34 36 … … 47 49 'submit_field' => '<p class="my-custom-submit-field">%1$s %2$s</p>', 48 50 ); 51 49 52 $form = get_echo( 'comment_form', array( $args, $p ) ); 50 53 … … 95 98 ), 96 99 ); 100 97 101 $form = get_echo( 'comment_form', array( $args, $p ) ); 98 102 … … 101 105 $this->assertRegExp( '|<p class="comment\-form\-cookies\-consent">.*?</p>|', $form ); 102 106 } 107 108 /** 109 * @ticket 47975 110 */ 111 public function test_aria_describedby_email_notes_should_not_be_added_if_no_email_notes() { 112 $p = self::factory()->post->create(); 113 114 $form_with_aria = get_echo( 'comment_form', array( array(), $p ) ); 115 116 $this->assertContains( 'aria-describedby="email-notes"', $form_with_aria ); 117 118 $args = array( 119 'comment_notes_before' => '', 120 ); 121 122 $form_without_aria = get_echo( 'comment_form', array( $args, $p ) ); 123 124 $this->assertNotContains( 'aria-describedby="email-notes"', $form_without_aria ); 125 } 103 126 }
Note: See TracChangeset
for help on using the changeset viewer.