function ElementTest::testWrapperIds

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testWrapperIds()
  2. 8.9.x core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testWrapperIds()
  3. 10 core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testWrapperIds()

Tests wrapper ids for checkboxes and radios.

1 call to ElementTest::testWrapperIds()
ElementTest::testFormElements in core/modules/system/tests/src/Functional/Form/ElementTest.php
Test form elements.

File

core/modules/system/tests/src/Functional/Form/ElementTest.php, line 127

Class

ElementTest
Tests building and processing of core form elements.

Namespace

Drupal\Tests\system\Functional\Form

Code

protected function testWrapperIds() : void {
  $this->drupalGet('form-test/checkboxes-radios');
  // Verify that wrapper id is different from element id.
  foreach ([
    'checkboxes',
    'radios',
  ] as $type) {
    // A single element id is found.
    $this->assertSession()
      ->elementsCount('xpath', "//div[@id='edit-{$type}']", 1);
    $this->assertSession()
      ->elementsCount('xpath', "//fieldset[@id='edit-{$type}--wrapper']", 1);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.