public function ElementContext::assertEmptyElement in Lightning Core 8.2
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.3 tests/contexts/ElementContext.behat.inc \Acquia\LightningExtension\Context\ElementContext::assertEmptyElement()
- 8.4 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
ExpectationException If the element contains any HTML (leading and trailing white space is trimmed out).
File
- tests/
contexts/ ElementContext.behat.inc, line 34
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());
}
}