You are here

public function ConditionalFieldTextTextareaTest::testCreateConfigInvisibleEmpty in Conditional Fields 8

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

Tests creating Conditional Field: inVisible if isFilled.

File

tests/src/FunctionalJavascript/ConditionalFieldTextTextareaTest.php, line 448

Class

ConditionalFieldTextTextareaTest
Test Conditional Fields Text Handler.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

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

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

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

  // Visit Article Add form to check that conditions are applied.
  $this
    ->drupalGet('node/add/article');

  //
  $this
    ->waitUntilHidden($this->targetFieldWrapp, 0, 'Article \'' . $this->targetFieldName . '\' field is visible');
  $this
    ->changeField($this->fieldSelector, 'This field is not empty.');
  $this
    ->waitUntilVisible($this->targetFieldWrapp, 10, 'Article \'' . $this->targetFieldName . '\' field is not visible');
}