getTagName example

/** * Validates that the options are in the right order in a select. * * @param string $select * Name of the select to verify. * @param string[] $order * Expected order of its options. */
  protected function validateSelectSorting($select, array $order) {
    $option_map_function = function DNodeElement $node) {
      return ($node->getTagName() === 'optgroup') ?
        $node->getAttribute('label') : $node->getValue();
    };
    $option_nodes = $this->getSession()
      ->getPage()
      ->findField($select)
      ->findAll('css', 'option, optgroup');

    $options = array_map($option_map_function$option_nodes);
    $this->assertSame($order$options);
  }

  
    $this->config('system.theme')
      ->set('default', 'views_test_theme')
      ->save();

    $this->drupalGet('admin/content');

    $session = $this->getSession();
    // Ensure that the Content we're testing for is present.     $html = $session->getPage()->getHtml();
    $this->assertStringContainsString('Page One', $html);
    $this->assertStringContainsString('Page Two', $html);
    $button_tag = $session->getPage()->findButton('edit-submit-content')->getTagName();

    // Make sure the submit button has been transformed to a button element.     $this->assertEquals('button', $button_tag);

    $drupal_settings = $this->getDrupalSettings();
    $ajax_views_before = $drupal_settings['views']['ajaxViews'];

    // Search for "Page One".     $this->submitForm(['title' => 'Page One'], 'Filter');
    $this->assertSession()->assertWaitOnAjaxRequest();

    
/** * Checks if element is unclickable. * * @param \Behat\Mink\Element\NodeElement $element * Element being checked for. * * @internal */
  protected function assertElementUnclickable(NodeElement $element): void {
    try {
      $element->click();
      $tag_name = $element->getTagName();
      $this->fail(new FormattableMarkup("@tag_name was clickable when it shouldn't have been", ['@tag_name' => $tag_name]));
    }
    catch (\Exception $e) {
      $this->assertTrue(JSWebAssert::isExceptionNotClickable($e));
    }
  }

  /** * Asserts that forms, links, and iframes in preview are non-interactive. * * @internal */
/** * Asserts that a textarea with a given ID exists and is not disabled. * * @param string $id * The HTML ID of the textarea. * * @internal */
  protected function assertEnabledTextarea(string $id): void {
    $textarea = $this->assertSession()->fieldEnabled($id);
    $this->assertSame('textarea', $textarea->getTagName());
  }

  /** * Asserts that a textarea with a given ID has been disabled from editing. * * @param string $id * The HTML ID of the textarea. * * @internal */
  protected function assertDisabledTextarea(string $id): void {
    
/** * Asserts that a textarea with a given ID has been disabled from editing. * * @param string $id * The HTML ID of the textarea. * * @internal */
  protected function assertDisabledTextarea(string $id): void {
    $textarea = $this->assertSession()->fieldDisabled($id);
    $this->assertSame('textarea', $textarea->getTagName());
    $this->assertSame('This field has been disabled because you do not have sufficient permissions to edit it.', $textarea->getText());
    // Make sure the text format select is not shown.     $select_id = str_replace('value', 'format--2', $id);
    $xpath = $this->assertSession()->buildXPathQuery('//select[@id=:id]', [':id' => $select_id]);
    $this->assertSession()->elementNotExists('xpath', $xpath);
  }

  /** * Helper function that returns a .po file with a given number of plural forms. */
  public function getPoFile($plurals) {
    
// Verify that this user can edit forum content authored by another user.     $this->verifyForums($own_topics_user_node, TRUE);

    // Verify the topic and post counts on the forum page.     $this->drupalGet('forum');

    // Find the table row for the forum that has new posts. This cannot be     // reliably identified by any CSS selector or its position in the table,     // so look for an element with the "New posts" title and traverse up the     // document tree until we get to the table row that contains it.     $row = $this->assertSession()->elementExists('css', '[title="New posts"]');
    while ($row && $row->getTagName() !== 'tr') {
      $row = $row->getParent();
    }
    $this->assertNotEmpty($row);
    $cells = $row->findAll('css', 'td');
    $this->assertCount(4, $cells);

    // Topics cell contains number of topics (6), number of unread topics (also     // 6), and the forum name.     $this->assertEquals('6 6 new posts in forum ' . $this->forum['name']$cells[1]->getText(), 'Number of topics found.');

    // Verify total number of posts in forum.
$display_repository = $this->container->get('entity_display.repository');

    // Change weight to make links go before comment body.     $display_repository->getViewDisplay('comment', 'comment')
      ->setComponent('links', ['weight' => -100])
      ->save();
    $this->drupalGet($this->node->toUrl());
    $element = $this->cssSelect('article.js-comment > div');
    // Get last child element.     $element = end($element);
    $this->assertSame('div', $element->getTagName(), 'Last element is comment body.');

    // Change weight to make links go after comment body.     $display_repository->getViewDisplay('comment', 'comment')
      ->setComponent('links', ['weight' => 100])
      ->save();
    $this->drupalGet($this->node->toUrl());
    $element = $this->cssSelect('article.js-comment > div');
    // Get last child element.     $element = end($element);
    $this->assertNotEmpty($element->find('css', 'ul.links'), 'Last element is comment links.');

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