protected function EditModeTest::getTabbableElementsCount in Drupal 10
Same name and namespace in other branches
- 8 core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php \Drupal\Tests\contextual\FunctionalJavascript\EditModeTest::getTabbableElementsCount()
- 9 core/modules/contextual/tests/src/FunctionalJavascript/EditModeTest.php \Drupal\Tests\contextual\FunctionalJavascript\EditModeTest::getTabbableElementsCount()
Gets the number of elements that are tabbable.
Return value
int The number of tabbable elements.
File
- core/
modules/ contextual/ tests/ src/ FunctionalJavascript/ EditModeTest.php, line 136
Class
- EditModeTest
- Tests edit mode.
Namespace
Drupal\Tests\contextual\FunctionalJavascriptCode
protected function getTabbableElementsCount() {
// Mark all tabbable elements.
$this
->getSession()
->executeScript("jQuery(window.tabbable.tabbable(document.body)).attr('data-marked', '');");
// Count all marked elements.
$count = count($this
->getSession()
->getPage()
->findAll('css', "[data-marked]"));
// Remove set attributes.
$this
->getSession()
->executeScript("jQuery('[data-marked]').removeAttr('data-marked');");
return $count;
}