You are here

protected function ElementContext::findDetails in Lightning Core 8.2

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.3 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 exact summary text.

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 299

Class

ElementContext
Contains miscellaneous step definitions for working with HTML elements.

Namespace

Acquia\LightningExtension\Context

Code

protected function findDetails($summary, ElementInterface $container) {

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