Commit 84b2d23a authored by lauriii's avatar lauriii

Issue #3088681 by phenaproxima, seanB, bnjmnm, lauriii: Make MediaLibraryTest...

Issue #3088681 by phenaproxima, seanB, bnjmnm, lauriii: Make MediaLibraryTest less dependent on representational CSS selectors

(cherry picked from commit 1aaa1d95)
parent b9603de0
......@@ -58,7 +58,7 @@
? strings.hide
: strings.show,
)
.parent()
.closest('.js-media-library-widget')
.find('.js-media-library-item-weight')
.parent()
.toggle();
......
......@@ -31,7 +31,7 @@
};
$('.js-media-library-widget-toggle-weight', context).once('media-library-toggle').on('click', function (e) {
e.preventDefault();
$(e.currentTarget).toggleClass('active').text($(e.currentTarget).hasClass('active') ? strings.hide : strings.show).parent().find('.js-media-library-item-weight').parent().toggle();
$(e.currentTarget).toggleClass('active').text($(e.currentTarget).hasClass('active') ? strings.hide : strings.show).closest('.js-media-library-widget').find('.js-media-library-item-weight').parent().toggle();
}).text(strings.show);
$('.js-media-library-item-weight', context).once('media-library-toggle').parent().hide();
}
......
......@@ -173,6 +173,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'container',
'#attributes' => [
'class' => [
'js-media-library-add-form-added-media',
'media-library-add-form__added-media',
],
'aria-label' => $this->t('Added media items'),
......
......@@ -317,7 +317,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#target_bundles' => isset($settings['target_bundles']) ? $settings['target_bundles'] : FALSE,
'#attributes' => [
'id' => $wrapper_id,
'class' => ['media-library-widget'],
'class' => ['js-media-library-widget', 'media-library-widget'],
],
'#attached' => [
'library' => ['media_library/widget'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment