Verified Commit 3ec2fa91 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3463548 by catch, smustgrave: Consolidate methods on FormElementsLabelsTest

(cherry picked from commit f82e35fb)
parent 1009866a
Loading
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -26,6 +26,16 @@ class ElementsLabelsTest extends BrowserTestBase {
   */
  protected $defaultTheme = 'stark';

  /**
   * Tests form elements.
   */
  public function testFormElements(): void {
    $this->testFormLabels();
    $this->testTitleEscaping();
    $this->testFormDescriptions();
    $this->testFormsInThemeLessEnvironments();
  }

  /**
   * Tests form element rendering.
   *
@@ -35,7 +45,7 @@ class ElementsLabelsTest extends BrowserTestBase {
   * - Prefix and suffix render element placement.
   * - Form element title attributes.
   */
  public function testFormLabels(): void {
  protected function testFormLabels(): void {
    $this->drupalGet('form_test/form-labels');

    // Check that the checkbox/radio processing is not interfering with
@@ -104,7 +114,7 @@ public function testFormLabels(): void {
  /**
   * Tests XSS-protection of element labels.
   */
  public function testTitleEscaping(): void {
  protected function testTitleEscaping(): void {
    $this->drupalGet('form_test/form-labels');
    foreach (FormTestLabelForm::$typesWithTitle as $type) {
      $this->assertSession()->responseContains("$type alert('XSS') is XSS filtered!");
@@ -115,7 +125,7 @@ public function testTitleEscaping(): void {
  /**
   * Tests different display options for form element descriptions.
   */
  public function testFormDescriptions(): void {
  protected function testFormDescriptions(): void {
    $this->drupalGet('form_test/form-descriptions');

    // Check #description placement with #description_display='after'.
@@ -142,7 +152,7 @@ public function testFormDescriptions(): void {
  /**
   * Tests forms in theme-less environments.
   */
  public function testFormsInThemeLessEnvironments(): void {
  protected function testFormsInThemeLessEnvironments(): void {
    $form = $this->getFormWithLimitedProperties();
    $render_service = $this->container->get('renderer');
    // This should not throw any notices.