feat(mat-select): Improve mat-select harness DX
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### Feature Description
Currently, when using `matSelectHarness.getOptions()`, an empty array is returned if the `matSelectHarness.open()` method is not called beforehand. This can be confusing for users, who may not realize they need to call `matSelectHarness.open()` first.
To improve the user experience, I suggest adding an error message similar to what is done in `matAutoCompleteHarness`, so that if `getOptions()` is called before `open()`, an error will be thrown informing the user to call `open()` first.
This change would save users time and frustration by providing immediate feedback on what they need to do to correctly use the `getOptions()` method.
matAutoComplete implementation:
https://github.com/angular/components/blob/22e928c4fce56fc3619e7aecd0affbb8972847ae/src/material/autocomplete/testing/autocomplete-harness.ts#L80
I can make a PR for it :)
Thanks.
Contributor guide
Research direction
Start by reading the linked matAutoComplete harness implementation, especially its handling of getOptions() before open(). Then inspect the matSelectHarness getOptions() and open() entry points and add equivalent feedback when options are requested while closed. Done means the closed-state call reports that open() is required instead of returning an empty array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- developer-experience, testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100