enableTheme example

protected function doTestBlocks($theme$block_plugin$new_page_text$element_selector$label_selector$button_text$toolbar_item$permissions) {
    if ($permissions) {
      $this->grantPermissions(Role::load(Role::AUTHENTICATED_ID)$permissions);
    }
    if ($new_page_text) {
      // Some asserts can be based on this value, so it should not be the same       // for different blocks, because it can be saved in the site config.       $new_page_text = $new_page_text . ' ' . $theme . ' ' . $block_plugin;
    }
    $web_assert = $this->assertSession();
    $page = $this->getSession()->getPage();
    $this->enableTheme($theme);
    $block = $this->placeBlock($block_plugin);
    $block_selector = $this->getBlockSelector($block);
    $block_id = $block->id();
    $this->drupalGet('user');

    $link = $web_assert->waitForElement('css', "$block_selector .contextual-links li a");
    $this->assertEquals('Quick edit', $link->getHtml(), "'Quick edit' is the first contextual link for the block.");
    $destination = (string) $this->loggedInUser->toUrl()->toString();
    $this->assertStringContainsString("/admin/structure/block/manage/$block_id/settings-tray?destination=$destination", $link->getAttribute('href'));

    if (isset($toolbar_item)) {
      
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * Tests that non-contextual links will work with the off-canvas dialog. * * @dataProvider themeDataProvider */
  public function testOffCanvasLinks($theme) {
    $this->enableTheme($theme);
    $this->drupalGet('/off-canvas-test-links');

    $page = $this->getSession()->getPage();
    $web_assert = $this->assertSession();

    // Confirm touchevents detection is loaded with Off Canvas assets.     $this->assertNotNull($web_assert->waitForElement('css', 'html.no-touchevents'));

    // Make sure off-canvas dialog is on page when first loaded.     $web_assert->elementNotExists('css', '#drupal-off-canvas');

    
Home | Imprint | This part of the site doesn't use cookies.