function JSWebAssert::assertNotVisibleInViewport
Same name in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::assertNotVisibleInViewport()
- 8.9.x core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::assertNotVisibleInViewport()
- 10 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::assertNotVisibleInViewport()
Tests that a node, or its specific corner, is not visible in the viewport.
Note: the node should exist in the page, otherwise this assertion fails.
Parameters
string $selector_type: The element selector type (css, xpath).
string|array $selector: The element selector. Note: the first found element is used.
bool|string $corner: (Optional) Corner to test: topLeft, topRight, bottomRight, bottomLeft. Or FALSE to check the complete element (default).
string $message: (optional) A message for the exception.
Throws
\Behat\Mink\Exception\ElementHtmlException When the element doesn't exist.
\Behat\Mink\Exception\ElementNotFoundException When the element is not visible in the viewport.
See also
\Drupal\FunctionalJavascriptTests\JSWebAssert::assertVisibleInViewport()
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php, line 370
Class
- JSWebAssert
- Defines a class with methods for asserting presence of elements during tests.
Namespace
Drupal\FunctionalJavascriptTestsCode
public function assertNotVisibleInViewport($selector_type, $selector, $corner = FALSE, $message = 'Element is visible in the viewport.') {
$node = $this->session
->getPage()
->find($selector_type, $selector);
if ($node === NULL) {
if (is_array($selector)) {
$selector = implode(' ', $selector);
}
throw new ElementNotFoundException($this->session
->getDriver(), 'element', $selector_type, $selector);
}
$result = $this->checkNodeVisibilityInViewport($node, $corner);
if ($result) {
throw new ElementHtmlException($message, $this->session
->getDriver(), $node);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.