function SortableTestTrait::sortableAfter
Same name in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/SortableTestTrait.php \Drupal\FunctionalJavascriptTests\SortableTestTrait::sortableAfter()
- 10 core/tests/Drupal/FunctionalJavascriptTests/SortableTestTrait.php \Drupal\FunctionalJavascriptTests\SortableTestTrait::sortableAfter()
- 11.x core/tests/Drupal/FunctionalJavascriptTests/SortableTestTrait.php \Drupal\FunctionalJavascriptTests\SortableTestTrait::sortableAfter()
Simulates a drag moving an element after its sibling in the same container.
Parameters
string $item: The HTML selector for the element to be moved.
string $target: The HTML selector for the sibling element.
string $from: The HTML selector for the element container.
1 call to SortableTestTrait::sortableAfter()
- ContentPreviewToggleTest::testContentPreviewToggle in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ ContentPreviewToggleTest.php - Tests the content preview toggle.
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ SortableTestTrait.php, line 72
Class
- SortableTestTrait
- Provides functions for simulating sort changes.
Namespace
Drupal\FunctionalJavascriptTestsCode
protected function sortableAfter($item, $target, $from) {
$item = addslashes($item);
$target = addslashes($target);
$from = addslashes($from);
$script = <<<JS
(function (src, to) {
var sourceElement = document.querySelector(src);
var toElement = document.querySelector(to);
toElement.insertAdjacentElement('afterend', sourceElement);
})('{<span class="php-variable">$item</span>}', '{<span class="php-variable">$target</span>}')
JS;
$options = [
'script' => $script,
'args' => [],
];
$this->getSession()
->getDriver()
->getWebDriverSession()
->execute($options);
$this->sortableUpdate($item, $from);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.