You are here

public function ElementTest::testRequiredFieldsetsAndDetails in Drupal 10

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

Tests the #required property on details and fieldset elements.

File

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

Class

ElementTest
Tests building and processing of core form elements.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testRequiredFieldsetsAndDetails() {
  $this
    ->drupalGet('form-test/group-details');
  $this
    ->assertEmpty($this
    ->cssSelect('summary.form-required'));
  $this
    ->drupalGet('form-test/group-details/1');
  $this
    ->assertNotEmpty($this
    ->cssSelect('summary.form-required'));
  $this
    ->drupalGet('form-test/group-fieldset');
  $this
    ->assertEmpty($this
    ->cssSelect('span.form-required'));
  $this
    ->drupalGet('form-test/group-fieldset/1');
  $this
    ->assertNotEmpty($this
    ->cssSelect('span.form-required'));
}