You are here

public function ElementContext::assertOpenDetails in Lightning Core 8

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

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

@Then I should see an open :summary details element

Parameters

string $summary: The exact summary text.

ElementInterface $container: (optional) The element in which to search for the <details> element.

Throws

\Behat\Mink\Exception\ExpectationException if the <details> element is closed.

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

File

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

Class

ElementContext
Contains miscellaneous step definitions for working with HTML elements.

Namespace

Acquia\LightningExtension\Context

Code

public function assertOpenDetails($summary, ElementInterface $container = NULL) {
  $open = $this
    ->assertDetails($summary, $container)
    ->hasAttribute('open');
  if (!$open) {
    throw new ExpectationException("Expected '{$summary}' details to be open, but it is closed.", $this
      ->getSession()
      ->getDriver());
  }
}