You are here

public function ConditionalFieldTextTextareaTest::testCreateConfigVisibleFilled in Conditional Fields 4.x

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

Tests creating Conditional Field: Visible if isFilled.

File

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

Class

ConditionalFieldTextTextareaTest
Test Conditional Fields Text Handler.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

public function testCreateConfigVisibleFilled() {
  $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');

  // Check that the field Body is not visible.
  $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');
}