Skip to content

Commit

Permalink
[Autocomplete] Fix extending Tom Select when using custom ajax class
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfkuehnel committed Sep 1, 2022
1 parent dd07ad6 commit 3abb968
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{# EasyAdminAutocomplete form type #}
{% block ux_entity_autocomplete_widget %}
{{ form_widget(form.autocomplete, { attr: attr|merge({ required: required }) }) }}
{{ form_widget(form.autocomplete, { attr: form.autocomplete.vars.attr|merge({ required: required }) }) }}
{% endblock ux_entity_autocomplete_widget %}

{% block ux_entity_autocomplete_label %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public function configureOptions(OptionsResolver $resolver)
return true;
},
'placeholder' => 'What should we eat?',
'attr' => [
'data-controller' => 'custom-autocomplete',
],
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testFieldsRenderWithStimulusController()
$this->browser()
->throwExceptions()
->get('/test-form')
->assertElementAttributeContains('#product_category_autocomplete', 'data-controller', 'symfony--ux-autocomplete--autocomplete')
->assertElementAttributeContains('#product_category_autocomplete', 'data-controller', 'custom-autocomplete symfony--ux-autocomplete--autocomplete')
->assertElementAttributeContains('#product_category_autocomplete', 'data-symfony--ux-autocomplete--autocomplete-url-value', '/test/autocomplete/category_autocomplete_type')

->assertElementAttributeContains('#product_portionSize', 'data-controller', 'symfony--ux-autocomplete--autocomplete')
Expand Down

0 comments on commit 3abb968

Please sign in to comment.