You are here

public function ConditionalFieldTextWithSummaryTest::testCreateConfigInvisibleEmpty in Conditional Fields 4.x

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

Tests creating Conditional Field: inVisible if isFilled.

File

tests/src/FunctionalJavascript/ConditionalFieldTextWithSummaryTest.php, line 439

Class

ConditionalFieldTextWithSummaryTest
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('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, 'Article Body field is visible');
  $this
    ->changeField($this->fieldSelector, 'This field is not empty.');
  $this
    ->waitUntilVisible('.field--name-body', 10, 'Article Body field is not visible');
}