Commit 03e2f4a1 authored by dragos-dumi's avatar dragos-dumi Committed by borisson_

Issue #2896166 by dragos-dumi: facets-item-list.html.twig overrides...

Issue #2896166 by dragos-dumi: facets-item-list.html.twig overrides attributes, and they replaced by JS for certain widgets
parent 69ceca47
......@@ -27,7 +27,17 @@
$('.js-facets-dropdown-links').once('facets-dropdown-transform').each(function () {
var $ul = $(this);
var $links = $ul.find('.facet-item a');
var $dropdown = $('<select class="facets-dropdown" />').data($ul.data());
var $dropdown = $('<select />');
// Preserve all attributes of the list.
$ul.each(function() {
$.each(this.attributes,function(idx, elem) {
$dropdown.attr(elem.name, elem.value);
});
});
// Remove the class which we are using for .once().
$dropdown.removeClass('js-facets-dropdown-links');
$dropdown.addClass('facets-dropdown');
var id = $(this).data('drupal-facet-id');
var default_option_label = settings.facets.dropdown_widget[id]['facet-default-option-label'];
......
......@@ -233,6 +233,9 @@ class WidgetJSTest extends JavascriptTestBase {
$dropdown = $block->find('css', 'select');
$dropdown->isVisible();
$block->find('css', '.item-list__dropdown');
$block->isVisible();
$options = $dropdown->findAll('css', 'option');
$this->assertCount(3, $options);
......
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