You are here

public function HierarchicalTaxonomyMenuBasicTest::testCollapsedAndStayOpen in Hierarchical Taxonomy Menu 8

Test the block with collapsed and stay open content.

File

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

Class

HierarchicalTaxonomyMenuBasicTest
Tests the Hierarchical Taxonomy Menu basic config options.

Namespace

Drupal\Tests\hierarchical_taxonomy_menu\FunctionalJavascript

Code

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

  // We should see all parents and all descendants of the first parent.
  for ($i = 1; $i < 4; $i++) {
    $this
      ->assertSession()
      ->pageTextContains('Parent term ' . $i);
    for ($n = 1; $n < 12; $n++) {
      if ($i == 1) {
        $this
          ->assertSession()
          ->pageTextContains('Child term ' . $i . '-' . $n);
      }
      else {
        $this
          ->assertSession()
          ->pageTextNotContains('Child term ' . $i . '-' . $n);
      }
    }
  }
}