diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 332f81e..2330947 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -903,7 +903,7 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state $element['#defaults_loaded'] = TRUE; } // Assign basic defaults common for all form elements. - // NOTE: description_display is below by default, excepted for details. + // Note that #description_display is below by default, excepted for details. $element += array( '#required' => FALSE, '#attributes' => array(), diff --git a/core/modules/system/src/Tests/Form/ElementsDetailsTest.php b/core/modules/system/src/Tests/Form/ElementsDetailsTest.php index 84d67c2..872821d 100644 --- a/core/modules/system/src/Tests/Form/ElementsDetailsTest.php +++ b/core/modules/system/src/Tests/Form/ElementsDetailsTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\system\Tests\Form\ElementsDetailsTest. + * Contains \Drupal\system\Tests\Form\ElementsDetailsTest. */ namespace Drupal\system\Tests\Form; @@ -26,26 +26,26 @@ class ElementsDetailsTest extends WebTestBase { /** * Tests different display options for details element descriptions. */ - function testFieldsetDescriptions() { + public function testFieldsetDescriptions() { $this->drupalGet('form-test/group-details'); // Check #description default placement. $field_id = 'edit-meta'; $description_id = $field_id . '--description'; $elements = $this->xpath('//details[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]//div/preceding-sibling::div'); - $this->assertTrue(isset($elements[0]), t('Properly places by default the #description element before the form item within details group.')); + $this->assertTrue(isset($elements[0]), 'Properly places by default the #description element before the form item within details group.'); // Check #description placement with #description_display='before'. $field_id = 'edit-details-before'; $description_id = $field_id . '--description'; $elements = $this->xpath('//details[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]//div[@id="edit-meta-before"]/preceding-sibling::div[@id="' . $description_id . '"]'); - $this->assertTrue(isset($elements[0]), t('Properly places the #description element before the form item within details group.')); + $this->assertTrue(isset($elements[0]), 'Properly places the #description element before the form item within details group.'); // Check #description placement with #description_display='after'. $field_id = 'edit-details-after'; $description_id = $field_id . '--description'; $elements = $this->xpath('//details[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]//div[@id="edit-meta-after"]/following-sibling::div[@id="' . $description_id . '"]'); - $this->assertTrue(isset($elements[0]), t('Properly places the #description element after the form item within details group.')); + $this->assertTrue(isset($elements[0]), 'Properly places the #description element after the form item within details group.'); // Check if the class is 'visually-hidden' on the form details description // for the option with #description_display='invisible' and also check that @@ -53,6 +53,7 @@ function testFieldsetDescriptions() { $field_id = 'edit-details-invisible'; $description_id = $field_id . '--description'; $elements = $this->xpath('//details[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]//div[@id="edit-meta-invisible"]/following-sibling::div[contains(@class, "visually-hidden")]'); - $this->assertTrue(isset($elements[0]), t('Properly renders the #description element visually-hidden within details group.')); + $this->assertTrue(isset($elements[0]), 'Properly renders the #description element visually-hidden within details group.'); } + } diff --git a/core/modules/system/src/Tests/Form/ElementsLabelsTest.php b/core/modules/system/src/Tests/Form/ElementsLabelsTest.php index ed42b8d..84361af 100644 --- a/core/modules/system/src/Tests/Form/ElementsLabelsTest.php +++ b/core/modules/system/src/Tests/Form/ElementsLabelsTest.php @@ -106,19 +106,19 @@ function testFormDescriptions() { $field_id = 'edit-form-textfield-test-description-default'; $description_id = $field_id . '--description'; $elements = $this->xpath('//input[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]/following-sibling::div[@id="' . $description_id . '"]'); - $this->assertTrue(isset($elements[0]), t('Properly places by default the #description element after the form item.')); + $this->assertTrue(isset($elements[0]), 'Properly places by default the #description element after the form item.'); // Check #description placement with #description_display='after'. $field_id = 'edit-form-textfield-test-description-after'; $description_id = $field_id . '--description'; $elements = $this->xpath('//input[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]/following-sibling::div[@id="' . $description_id . '"]'); - $this->assertTrue(isset($elements[0]), t('Properly places the #description element after the form item.')); + $this->assertTrue(isset($elements[0]), 'Properly places the #description element after the form item.'); // Check #description placement with #description_display='before'. $field_id = 'edit-form-textfield-test-description-before'; $description_id = $field_id . '--description'; $elements = $this->xpath('//input[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]/preceding-sibling::div[@id="' . $description_id . '"]'); - $this->assertTrue(isset($elements[0]), t('Properly places the #description element before the form item.')); + $this->assertTrue(isset($elements[0]), 'Properly places the #description element before the form item.'); // Check if the class is 'visually-hidden' on the form element description // for the option with #description_display='invisible' and also check that @@ -126,7 +126,7 @@ function testFormDescriptions() { $field_id = 'edit-form-textfield-test-description-invisible'; $description_id = $field_id . '--description'; $elements = $this->xpath('//input[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]/following-sibling::div[contains(@class, "visually-hidden")]'); - $this->assertTrue(isset($elements[0]), t('Properly renders the #description element visually-hidden.')); + $this->assertTrue(isset($elements[0]), 'Properly renders the #description element visually-hidden.'); } }