You are here

public function ConditionalFieldCheckboxTest::testVisibleChecked 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::testVisibleChecked()

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

Overrides ConditionalFieldCheckedUncheckedInterface::testVisibleChecked

File

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

Class

ConditionalFieldCheckboxTest
Test Conditional Fields Checkbox state.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

public function testVisibleChecked() {
  $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');
}