You are here

public function SlideTypeTest::setUp in Collapsiblock 4.x

Same name and namespace in other branches
  1. 3.x tests/src/FunctionalJavascript/SlideTypeTest.php \Drupal\Tests\collapsiblock\FunctionalJavascript\SlideTypeTest::setUp()

Overrides CollapsiblockJavaScriptTestBase::setUp

File

tests/src/FunctionalJavascript/SlideTypeTest.php, line 36

Class

SlideTypeTest
Test the "Remember collapsed state on active pages" behavior.

Namespace

Drupal\Tests\collapsiblock\FunctionalJavascript

Code

public function setUp() : void {
  parent::setUp();

  // Create a test block with the Block collapse behavior of "Collapsible,
  // expanded by default"; and prepare some XPath selectors to find the title
  // and content elements after that block undergoes client-side DOM
  // transformation.
  $this->collapsiblockTestBlock = $this
    ->drupalPlaceBlock('system_powered_by_block', [
    'label_display' => TRUE,
  ]);
  $this
    ->setCollapsiblockBlockInstanceSetting($this->collapsiblockTestBlock, 2, 'collapse_action');
  $testBlockHtmlId = 'block-' . $this->collapsiblockTestBlock
    ->id();
  $this->collapsiblockTestBlockTitleXpath = $this
    ->assertSession()
    ->buildXPathQuery('//*[@id=:blockId]//h2', [
    ':blockId' => $testBlockHtmlId,
  ]);
  $this->collapsiblockTestBlockContentXpath = $this
    ->assertSession()
    ->buildXPathQuery('//*[@id=:blockId]//span', [
    ':blockId' => $testBlockHtmlId,
    ':class' => 'content',
  ]);
}