You are here

public function ElementTest::testGroupElements in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ElementTest.php \Drupal\Tests\system\Functional\Form\ElementTest::testGroupElements()
  2. 10 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 169

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');
  $elements = $this
    ->xpath('//div[@class="details-wrapper"]//div[@class="details-wrapper"]//label');
  $this
    ->assertCount(1, $elements);
  $this
    ->drupalGet('form-test/group-container');
  $elements = $this
    ->xpath('//div[@id="edit-container"]//div[@class="details-wrapper"]//label');
  $this
    ->assertCount(1, $elements);
  $this
    ->drupalGet('form-test/group-fieldset');
  $elements = $this
    ->xpath('//fieldset[@id="edit-fieldset"]//div[@id="edit-meta"]//label');
  $this
    ->assertCount(1, $elements);
  $this
    ->drupalGet('form-test/group-vertical-tabs');
  $elements = $this
    ->xpath('//div[@data-vertical-tabs-panes]//details[@id="edit-meta"]//label');
  $this
    ->assertCount(1, $elements);
  $elements = $this
    ->xpath('//div[@data-vertical-tabs-panes]//details[@id="edit-meta-2"]//label');
  $this
    ->assertCount(1, $elements);
}