protected function SortableTestTrait::sortableAfter in Entity Embed 8
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.
File
- tests/
src/ FunctionalJavascript/ SortableTestTrait.php, line 97
Class
Namespace
Drupal\Tests\entity_embed\FunctionalJavascriptCode
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);
}