public function ConditionalFieldTextfieldTest::testVisibleFilled in Conditional Fields 4.x
Same name and namespace in other branches
- 8 tests/src/FunctionalJavascript/ConditionalFieldTextfieldTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\ConditionalFieldTextfieldTest::testVisibleFilled()
Tests creating Conditional Field: Visible if isFilled.
Overrides ConditionalFieldFilledEmptyInterface::testVisibleFilled
File
- tests/
src/ FunctionalJavascript/ ConditionalFieldTextfieldTest.php, line 351
Class
- ConditionalFieldTextfieldTest
- Test Conditional Fields Text Handler.
Namespace
Drupal\Tests\conditional_fields\FunctionalJavascriptCode
public function testVisibleFilled() {
$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, '01. Article Body field is visible');
$this
->changeField($this->fieldSelector, 'This field is not empty.');
$this
->waitUntilVisible($this->targetFieldWrapp, 10, '02. Article Body field is not visible');
$this
->changeField($this->fieldSelector, '');
$this
->waitUntilHidden($this->targetFieldWrapp, 10, '03. Article Body field is visible');
}