public function ConditionalFieldTextfieldTest::testVisibleValueNot in Conditional Fields 8
Same name and namespace in other branches
- 4.x tests/src/FunctionalJavascript/ConditionalFieldTextfieldTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\ConditionalFieldTextfieldTest::testVisibleValueNot()
The target field is Visible when the control field has value with NOT condition.
Overrides ConditionalFieldValueInterface::testVisibleValueNot
File
- tests/
src/ FunctionalJavascript/ ConditionalFieldTextfieldTest.php, line 262
Class
- ConditionalFieldTextfieldTest
- Test Conditional Fields Text Handler.
Namespace
Drupal\Tests\conditional_fields\FunctionalJavascriptCode
public function testVisibleValueNot() {
$this
->baseTestSteps();
$this
->createCondition($this->targetFieldName, 'field_' . $this->fieldName, 'visible', 'value');
$text_1 = $this
->getRandomGenerator()
->word(7);
$text_2 = $this
->getRandomGenerator()
->word(7);
$data = [
'condition' => 'value',
'values_set' => ConditionalFieldsInterface::CONDITIONAL_FIELDS_DEPENDENCY_VALUES_NOT,
'values' => implode("\r\n", [
$text_1,
$text_2,
]),
'grouping' => 'AND',
'state' => 'visible',
'effect' => 'show',
];
$this
->submitForm($data, 'Save settings');
// Check if that configuration is saved.
$this
->drupalGet('admin/structure/types/manage/article/conditionals');
$this
->assertSession()
->pageTextContains($this->targetFieldName . ' ' . 'field_' . $this->fieldName . ' visible value');
$this
->drupalGet('node/add/article');
$this
->waitUntilVisible($this->targetFieldWrapp, 0, '01. Article Body field is not visible');
$this
->changeField($this->fieldSelector, 'some-unique-text');
$this
->waitUntilVisible($this->targetFieldWrapp, 50, '02. Article Body field is not visible');
$this
->changeField($this->fieldSelector, $text_1);
$this
->waitUntilHidden($this->targetFieldWrapp, 50, '03. Article Body field is visible');
$this
->changeField($this->fieldSelector, $text_2);
$this
->waitUntilHidden($this->targetFieldWrapp, 50, '04. Article Body field is visible');
$this
->changeField($this->fieldSelector, "");
$this
->waitUntilVisible($this->targetFieldWrapp, 50, '05. Article Body field is not visible');
}