getTestThemes example


  protected function assertElementVisibleAfterWait($selector$locator$timeout = 10000) {
    $this->assertSession()->assertWaitOnAjaxRequest();
    $this->assertNotEmpty($this->assertSession()->waitForElementVisible($selector$locator$timeout));
  }

  /** * Data provider that returns theme name as the sole argument. */
  public function themeDataProvider() {
    $themes = $this->getTestThemes();
    $data = [];
    foreach ($themes as $theme) {
      $data[$theme] = [
        $theme,
      ];
    }
    return $data;
  }

}
    $block->delete();
    if ($permissions) {
      user_role_revoke_permissions(Role::AUTHENTICATED_ID, $permissions);
    }
  }

  /** * Creates tests for ::testBlocks(). */
  public function getBlockTests() {
    $blocks = [];
    foreach ($this->getTestThemes() as $theme) {
      $blocks += [
        "$theme: block-powered" => [
          'theme' => $theme,
          'block_plugin' => 'system_powered_by_block',
          'new_page_text' => 'Can you imagine anyone showing the label on this block',
          'element_selector' => 'span a',
          'label_selector' => 'h2',
          'button_text' => 'Save Powered by Drupal',
          'toolbar_item' => '#toolbar-item-user',
          NULL,
        ],
        "
// Check that advanced block form elements do not exist.     $web_assert->elementNotExists('css', 'input[data-drupal-selector="edit-visibility-request-path-pages"]');
    $web_assert->elementNotExists('css', 'select[data-drupal-selector="edit-region"]');
  }

  /** * {@inheritdoc} */
  protected function getTestThemes() {
    // Remove 'claro' theme. Settings Tray "Edit Mode" will not work with this     // theme because it removes all contextual links.     return array_filter(parent::getTestThemes()function D$theme) {
      return ($theme !== 'claro');
    });
  }

  /** * Gets the block CSS selector. * * @param \Drupal\block\Entity\Block $block * The block. * * @return string * The CSS selector. */
/** * Tests the body displacement behaves differently at a narrow width. */
  public function testNarrowWidth() {
    $narrow_width_breakpoint = 768;
    $offset = 20;
    $height = 800;
    $page = $this->getSession()->getPage();
    $web_assert = $this->assertSession();

    // Test the same functionality on multiple themes.     foreach ($this->getTestThemes() as $theme) {
      $this->enableTheme($theme);
      // Testing at the wider width.       $this->getSession()->resizeWindow($narrow_width_breakpoint + $offset$height);
      $this->drupalGet('/off-canvas-test-links');
      $this->assertFalse($page->find('css', '.dialog-off-canvas-main-canvas')->hasAttribute('style'), 'Body not padded on wide page load.');
      $page->clickLink("Open side panel 1");
      $this->waitForOffCanvasToOpen();
      // Check that the main canvas is padded when page is not narrow width and       // tray is open.       $page->waitFor(10, function D$page) {
        return $page->find('css', '.dialog-off-canvas-main-canvas')->hasAttribute('style');
      });
Home | Imprint | This part of the site doesn't use cookies.