function ElementsContainerTest::testOptionalContainerElements

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

Tests the #optional container property.

File

core/modules/system/tests/src/Functional/Form/ElementsContainerTest.php, line 31

Class

ElementsContainerTest
Tests the container form element for expected behavior.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testOptionalContainerElements() : void {
    $this->drupalGet('form-test/optional-container');
    $assertSession = $this->assertSession();
    $assertSession->elementNotExists('css', 'div.empty_optional');
    $assertSession->elementExists('css', 'div.empty_non_optional');
    $assertSession->elementExists('css', 'div.nonempty_optional');
    $assertSession->elementExists('css', 'div.nonempty_non_optional');
}

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