You are here

public function ElementTest::testGroupElements in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testGroupElements()

Tests the #group property.

File

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

Class

ElementTest
Tests building and processing of core form elements.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testGroupElements() {
  $this
    ->drupalGet('form-test/group-details');
  $this
    ->assertSession()
    ->elementsCount('xpath', '//div[@class="details-wrapper"]//div[@class="details-wrapper"]//label', 1);
  $this
    ->drupalGet('form-test/group-container');
  $this
    ->assertSession()
    ->elementsCount('xpath', '//div[@id="edit-container"]//div[@class="details-wrapper"]//label', 1);
  $this
    ->drupalGet('form-test/group-fieldset');
  $this
    ->assertSession()
    ->elementsCount('xpath', '//fieldset[@id="edit-fieldset"]//div[@id="edit-meta"]//label', 1);
  $this
    ->drupalGet('form-test/group-vertical-tabs');
  $this
    ->assertSession()
    ->elementsCount('xpath', '//div[@data-vertical-tabs-panes]//details[@id="edit-meta"]//label', 1);
  $this
    ->assertSession()
    ->elementsCount('xpath', '//div[@data-vertical-tabs-panes]//details[@id="edit-meta-2"]//label', 1);
}