You are here

private function ElementContext::findDetails in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.5 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::findDetails()
  2. 8 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::findDetails()
  3. 8.2 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::findDetails()
  4. 8.4 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::findDetails()

Asserts the existence of a <details> element by its summary text.

Parameters

string $summary: The summary text (case-insensitive).

\Behat\Mink\Element\ElementInterface $container: The element in which to search for the <details> element.

Return value

\Behat\Mink\Element\NodeElement|bool The <details> element, or FALSE if it was not found.

1 call to ElementContext::findDetails()
ElementContext::assertDetails in tests/contexts/ElementContext.behat.inc
Asserts the existence of a <details> element by its summary text.

File

tests/contexts/ElementContext.behat.inc, line 297

Class

ElementContext
Contains miscellaneous step definitions for working with HTML elements.

Namespace

Acquia\LightningExtension\Context

Code

private function findDetails($summary, ElementInterface $container) {
  $lowercase_summary = mb_strtolower($summary);

  /** @var \Behat\Mink\Element\NodeElement $element */
  foreach ($container
    ->findAll('css', 'details > summary') as $element) {
    $lowercase_element_text = mb_strtolower($element
      ->getText());
    if ($lowercase_element_text === $lowercase_summary) {
      return $element
        ->getParent();
    }
  }
  return FALSE;
}