Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add allowDuplicates property to AutocompleteArrayInput and fix #2311 #2912

Closed
wants to merge 4 commits into from

Conversation

tiagoschenkel
Copy link
Contributor

The method handleSuggestionSelected is adding the new value directly to the input through onChange method. Even when the property allowDuplicates is enabled in the AutocompleteArrayInputChip this element will be added.

This merge request adds a new property to AutocompleteArrayInput component, named allowDuplicates, that is used to allow or disallow insertion of duplicated elements.

Fixes #2311

@tiagoschenkel tiagoschenkel changed the title Added allowDuplicates property to AutocompleteArrayInput and fix #2311 Add allowDuplicates property to AutocompleteArrayInput and fix #2311 Feb 21, 2019
Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great 👍 Would you mind adding some tests though ?

@tiagoschenkel
Copy link
Contributor Author

tiagoschenkel commented Feb 26, 2019

Hi @djhi,

I could write some unit tests, but this would take more time.

Do you have in mind any specific test case?

For me is not 100% clear yet if this allowDuplicates property is a feature or a bug.

Yes, I'm adding a new property thinking about keeping backward compatibility, but them this flag should be disabled by default since the current behavior of the AutocompleteArrayInput is to not filter out duplicates.

My question is, does it make sense to add a new flag as a feature? Or should be the case that this is not intended behavior, then we should handle this as a bug and simply get rid of duplicated elements without having to add a new flag.

Got it?

Best!

@djhi
Copy link
Contributor

djhi commented Feb 26, 2019

Do you have in mind any specific test case?

That it allows or not allows duplicates depending on the allowDuplicates prop ?

My question is, does it make sense to add a new flag as a feature? Or should be the case that this is not intended behavior, then we should handle this as a bug and simply get rid of duplicated elements without having to add a new flag.

I'm sure there are cases where you want to allow duplicates so I think it's good to have a flag and it should be false by default

@tiagoschenkel
Copy link
Contributor Author

@djhi,

I'm trying to simulate an onSuggestionSelectedevent from Autosuggest component, to validate if the onChange method will be called or not based in the allowDuplicates property.

I'm not able to force a select event, so the inputValue state property is never changing.

My last two test cases are incomplete even when they are passing.

Could you help with this?

@fzaninotto
Copy link
Member

Superseded by #4026

@fzaninotto fzaninotto closed this Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants