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

clear* methods don't allow for sufficient customization #53

Open
maciejmyslinski opened this issue Dec 24, 2020 · 4 comments · May be fixed by #54
Open

clear* methods don't allow for sufficient customization #53

maciejmyslinski opened this issue Dec 24, 2020 · 4 comments · May be fixed by #54

Comments

@maciejmyslinski
Copy link

clear* methods assume the clearing icon is an svg. That's not always the case with customized react-select components. Could we improve the API of clear* methods so that such custom select components can be tested with them? eg. select method takes a config object.

@AmirTugi
Copy link

AmirTugi commented Jan 6, 2021

Having the same issue.
Trying to make a workaround with adding a <svg aria-hidden style={{ display: 'none' }} /> or something.
Would be nice to have support from the lib.

@romgain
Copy link
Owner

romgain commented Jan 6, 2021

Thanks for reporting this!

Would either of you be able to add this functionality in a PR?

@AmirTugi
Copy link

AmirTugi commented Jan 6, 2021

What is the desired functionality?
How do we allow flexibility with 0 configuration here? 🤔

@romgain
Copy link
Owner

romgain commented Jan 6, 2021

Unfortunately, I don't think this can be achieved with 0 config.
The 2 clear* methods would need to take in an optional config object with a clearElementSelector attribute that we'd use instead of the default hidden svg.

For instance, it could look like this:

await selectEvent.clearFirst(getByLabelText("Food"), { clearElementSelector: "div[title='clear options']" });

@AmirTugi AmirTugi linked a pull request Jan 9, 2021 that will close this issue
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 a pull request may close this issue.

3 participants