public function ElementContext::assertEmptyElement in Lightning Core 8.4
Same name and namespace in other branches
- 8.5 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertEmptyElement()
- 8 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertEmptyElement()
- 8.2 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertEmptyElement()
- 8.3 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertEmptyElement()
Asserts that an element is empty.
@Then the :selector element(s) should be empty
Parameters
string $selector: The element's CSS selector.
Throws
\Behat\Mink\Exception\ExpectationException If the element contains any HTML (leading and trailing white space is trimmed out).
File
- tests/
contexts/ ElementContext.behat.inc, line 35
Class
- ElementContext
- Contains miscellaneous step definitions for working with HTML elements.
Namespace
Acquia\LightningExtension\ContextCode
public function assertEmptyElement($selector) {
$content = $this
->assertSession()
->elementExists('css', $selector)
->getHtml();
if (trim($content)) {
throw new ExpectationException("Expected element '{$selector}' to be empty, but it is not.", $this
->getSession()
->getDriver());
}
}