You are here

public function ConditionalFieldEmailTest::testInvisibleEmpty in Conditional Fields 8

Same name and namespace in other branches
  1. 4.x tests/src/FunctionalJavascript/ConditionalFieldEmailTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\ConditionalFieldEmailTest::testInvisibleEmpty()

The target field is Invisible when the control field is Empty.

Overrides ConditionalFieldFilledEmptyInterface::testInvisibleEmpty

File

tests/src/FunctionalJavascript/ConditionalFieldEmailTest.php, line 533

Class

ConditionalFieldEmailTest
Test Conditional Fields Text Handler.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

public function testInvisibleEmpty() {
  $this
    ->baseTestSteps();

  // Visit a ConditionalFields configuration page for `Article` Content type.
  $this
    ->createCondition('body', 'field_' . $this->fieldName, '!visible', 'empty');

  // Check that configuration is saved.
  $this
    ->drupalGet('admin/structure/conditional_fields/node/article');
  $this
    ->assertSession()
    ->pageTextContains('body ' . 'field_' . $this->fieldName . ' !visible empty');

  // Visit Article Add form to check that conditions are applied.
  $this
    ->drupalGet('node/add/article');
  $this
    ->waitUntilHidden('.field--name-body', 0, '01. Article Body field is not visible');
  $this
    ->changeField($this->fieldSelector, 'test@drupal.org');
  $this
    ->waitUntilVisible('.field--name-body', 10, '02. Article Body field is visible');
}