You are here

public function ConditionalFieldTextfieldTest::testVisibleEmpty in Conditional Fields 8

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

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

Overrides ConditionalFieldFilledEmptyInterface::testVisibleEmpty

File

tests/src/FunctionalJavascript/ConditionalFieldTextfieldTest.php, line 384

Class

ConditionalFieldTextfieldTest
Test Conditional Fields Text Handler.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

public function testVisibleEmpty() {
  $this
    ->baseTestSteps();
  $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');
  $this
    ->drupalGet('node/add/article');
  $this
    ->waitUntilVisible($this->targetFieldWrapp, 0, '01. Article Body field is not visible');
  $this
    ->changeField($this->fieldSelector, 'This field is not empty.');
  $this
    ->waitUntilHidden($this->targetFieldWrapp, 10, '02. Article Body field is visible');
  $this
    ->changeField($this->fieldSelector, '');
  $this
    ->waitUntilVisible($this->targetFieldWrapp, 10, '03. Article Body field is not visible');
}