react-select-event icon indicating copy to clipboard operation
react-select-event copied to clipboard

clear* methods don't allow for sufficient customization

Open maciejmyslinski opened this issue 5 years ago • 4 comments

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.

maciejmyslinski avatar Dec 24 '20 07:12 maciejmyslinski

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.

AmirTugi avatar Jan 06 '21 15:01 AmirTugi

Thanks for reporting this!

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

romgain avatar Jan 06 '21 16:01 romgain

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

AmirTugi avatar Jan 06 '21 17:01 AmirTugi

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']" });

romgain avatar Jan 06 '21 19:01 romgain