From c9b7abd5a3a1a630c698e9a26338d6ddb4a096ef Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Wed, 11 Dec 2024 00:04:11 +0800 Subject: [PATCH 1/3] reorder autocomplete data-controller --- src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php b/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php index 149805e99e6..68de44fb3ab 100644 --- a/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php +++ b/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php @@ -55,7 +55,7 @@ public function finishView(FormView $view, FormInterface $form, array $options): $attr = $view->vars['attr'] ?? []; $controllerName = 'symfony--ux-autocomplete--autocomplete'; - $attr['data-controller'] = trim(($attr['data-controller'] ?? '').' '.$controllerName); + $attr['data-controller'] = $controllerName.' '.trim(($attr['data-controller'] ?? '')); $values = []; if ($options['autocomplete_url']) { From e11f4a0c1ab8749b918d085a20bfeb1235557949 Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Wed, 11 Dec 2024 00:20:15 +0800 Subject: [PATCH 2/3] fix tests --- .../tests/Functional/AutocompleteFormRenderingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Autocomplete/tests/Functional/AutocompleteFormRenderingTest.php b/src/Autocomplete/tests/Functional/AutocompleteFormRenderingTest.php index 92c7695c98c..c149833034a 100644 --- a/src/Autocomplete/tests/Functional/AutocompleteFormRenderingTest.php +++ b/src/Autocomplete/tests/Functional/AutocompleteFormRenderingTest.php @@ -30,7 +30,7 @@ public function testFieldsRenderWithStimulusController() $this->browser() ->throwExceptions() ->get('/test-form') - ->assertElementAttributeContains('#product_category', 'data-controller', 'custom-autocomplete symfony--ux-autocomplete--autocomplete') + ->assertElementAttributeContains('#product_category', 'data-controller', 'symfony--ux-autocomplete--autocomplete custom-autocomplete') ->assertElementAttributeContains('#product_category', 'data-symfony--ux-autocomplete--autocomplete-url-value', '/test/autocomplete/category_autocomplete_type?extra_options=') ->assertElementAttributeContains('#product_category', 'data-symfony--ux-autocomplete--autocomplete-min-characters-value', '2') ->assertElementAttributeContains('#product_category', 'data-symfony--ux-autocomplete--autocomplete-max-results-value', '25') From 7bbb4c4c401308cd2bbca91d73b92c8fc1eab185 Mon Sep 17 00:00:00 2001 From: Indra Gunawan Date: Wed, 11 Dec 2024 00:21:58 +0800 Subject: [PATCH 3/3] fix cs --- src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php b/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php index 68de44fb3ab..51c897e76b9 100644 --- a/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php +++ b/src/Autocomplete/src/Form/AutocompleteChoiceTypeExtension.php @@ -55,7 +55,7 @@ public function finishView(FormView $view, FormInterface $form, array $options): $attr = $view->vars['attr'] ?? []; $controllerName = 'symfony--ux-autocomplete--autocomplete'; - $attr['data-controller'] = $controllerName.' '.trim(($attr['data-controller'] ?? '')); + $attr['data-controller'] = $controllerName.' '.trim($attr['data-controller'] ?? ''); $values = []; if ($options['autocomplete_url']) {