You are here

public function HierarchicalTaxonomyMenuBasicTest::testCollapsed in Hierarchical Taxonomy Menu 8

Test the block with collapsed content.

File

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

Class

HierarchicalTaxonomyMenuBasicTest
Tests the Hierarchical Taxonomy Menu basic config options.

Namespace

Drupal\Tests\hierarchical_taxonomy_menu\FunctionalJavascript

Code

public function testCollapsed() {
  $this->block
    ->set('settings', [
    'label' => 'Hierarchical Taxonomy Menu',
    'label_display' => 'visible',
    'vocabulary' => $this->vocabulary
      ->id() . '|',
    'collapsible' => TRUE,
  ]);
  $this->block
    ->save();
  $this
    ->drupalGet('<front>');

  // 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);
    }
  }
}