You are here

public function ConditionalFieldCheckboxTest::testInvisibleUnchecked in Conditional Fields 8

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

The target field is Invisible when the control field is Unchecked.

Overrides ConditionalFieldCheckedUncheckedInterface::testInvisibleUnchecked

File

tests/src/FunctionalJavascript/ConditionalFieldCheckboxTest.php, line 88

Class

ConditionalFieldCheckboxTest
Test Conditional Fields Checkbox state.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

public function testInvisibleUnchecked() {
  $this
    ->baseTestSteps();

  // Visit a ConditionalFields configuration page for `Article` Content type.
  $this
    ->createCondition('body', 'promote', '!visible', '!checked');

  // Check that configuration is saved.
  $this
    ->drupalGet('admin/structure/conditional_fields/node/article');
  $this
    ->assertSession()
    ->pageTextContains('body promote !visible !checked');

  // Visit Article Add form to check that conditions are applied.
  $this
    ->drupalGet('node/add/article');
  $this
    ->waitUntilVisible('.field--name-body', 10, '01. Article Body field is not visible');
  $this
    ->changeSelect('#edit-promote-value', FALSE);
  $this
    ->waitUntilHidden('.field--name-body', 0, '02. Article Body field is visible');
}