MultiSelect: Respect value passed to the component regardless of custom value being allowed or not (#87906)

* MultiSelect: Respect value passed to the component regardless of custom value being allowed or not

* reset input for test

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
Dominik Prokop 2024-05-15 16:24:30 +02:00 committed by GitHub
parent 953c8f838f
commit fa63e03df3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -186,7 +186,7 @@ export function SelectBase<T, Rest = {}>({
const selectableValue = findSelectedValue(v.value ?? v, options);
// If the select allows custom values there likely won't be a selectableValue in options
// so we must return a new selectableValue
if (!allowCustomValue || selectableValue) {
if (selectableValue) {
return selectableValue;
}
return typeof v === 'string' ? toOption(v) : v;

View File

@ -189,6 +189,8 @@ describe('AlertGroups', () => {
renderAmNotifications();
await waitForElementToBeRemoved(ui.loadingIndicator.query());
// reset the input of the MultiSelect component
await user.type(ui.groupByInput.get(), '{backspace}');
await user.type(ui.groupByInput.get(), 'appName{enter}');
const groups = await ui.group.findAll();