Unverified Commit ff9dbe9b authored by lauriii's avatar lauriii
Browse files

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 aa9d5a31
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
? strings.hide ? strings.hide
: strings.show, : strings.show,
) )
.parent() .closest('.js-media-library-widget')
.find('.js-media-library-item-weight') .find('.js-media-library-item-weight')
.parent() .parent()
.toggle(); .toggle();
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
}; };
$('.js-media-library-widget-toggle-weight', context).once('media-library-toggle').on('click', function (e) { $('.js-media-library-widget-toggle-weight', context).once('media-library-toggle').on('click', function (e) {
e.preventDefault(); 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); }).text(strings.show);
$('.js-media-library-item-weight', context).once('media-library-toggle').parent().hide(); $('.js-media-library-item-weight', context).once('media-library-toggle').parent().hide();
} }
......
...@@ -173,6 +173,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -173,6 +173,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'container', '#type' => 'container',
'#attributes' => [ '#attributes' => [
'class' => [ 'class' => [
'js-media-library-add-form-added-media',
'media-library-add-form__added-media', 'media-library-add-form__added-media',
], ],
'aria-label' => $this->t('Added media items'), 'aria-label' => $this->t('Added media items'),
......
...@@ -317,7 +317,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen ...@@ -317,7 +317,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'#target_bundles' => isset($settings['target_bundles']) ? $settings['target_bundles'] : FALSE, '#target_bundles' => isset($settings['target_bundles']) ? $settings['target_bundles'] : FALSE,
'#attributes' => [ '#attributes' => [
'id' => $wrapper_id, 'id' => $wrapper_id,
'class' => ['media-library-widget'], 'class' => ['js-media-library-widget', 'media-library-widget'],
], ],
'#attached' => [ '#attached' => [
'library' => ['media_library/widget'], '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