You are here

public function HierarchicalTaxonomyMenuBasicTest::testCollapsedAndStayClosed in Hierarchical Taxonomy Menu 8

Test the block with collapsed and stay closed content.

File

tests/src/FunctionalJavascript/HierarchicalTaxonomyMenuBasicTest.php, line 309

Class

HierarchicalTaxonomyMenuBasicTest
Tests the Hierarchical Taxonomy Menu basic config options.

Namespace

Drupal\Tests\hierarchical_taxonomy_menu\FunctionalJavascript

Code

public function testCollapsedAndStayClosed() {
  $this->block
    ->set('settings', [
    'label' => 'Hierarchical Taxonomy Menu',
    'label_display' => 'visible',
    'vocabulary' => $this->vocabulary
      ->id() . '|',
    'collapsible' => TRUE,
    'stay_open' => FALSE,
  ]);
  $this->block
    ->save();
  $this
    ->drupalGet('taxonomy/term/6');

  // We should see just parents. All descendants must be hidden.
  for ($i = 1; $i < 4; $i++) {
    $this
      ->assertSession()
      ->pageTextContains('Parent term ' . $i);
    for ($n = 1; $n < 12; $n++) {
      $this
        ->assertSession()
        ->pageTextNotContains('Child term ' . $i . '-' . $n);
    }
  }
}