function EntityReferenceWidgetTest::sortableUpdate
Same name in other branches
- 10 core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php \Drupal\Tests\media_library\FunctionalJavascript\EntityReferenceWidgetTest::sortableUpdate()
- 11.x core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php \Drupal\Tests\media_library\FunctionalJavascript\EntityReferenceWidgetTest::sortableUpdate()
Overrides SortableTestTrait::sortableUpdate
File
-
core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ EntityReferenceWidgetTest.php, line 567
Class
- EntityReferenceWidgetTest
- Tests the Media library entity reference widget.
Namespace
Drupal\Tests\media_library\FunctionalJavascriptCode
protected function sortableUpdate($item, $from, $to = NULL) {
// See core/modules/media_library/js/media_library.widget.es6.js.
$script = <<<JS
(function (\$) {
var selection = document.querySelectorAll('.js-media-library-selection');
selection.forEach(function (widget) {
\$(widget).children().each(function (index, child) {
\$(child).find('.js-media-library-item-weight').val(index);
});
});
})(jQuery)
JS;
$this->getSession()
->executeScript($script);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.