feat(mat-select): Improve mat-select harness DX
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
### 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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia leggendo l’implementazione collegata dell’harness matAutoComplete, in particolare la gestione di getOptions() prima di open(). Poi esamina i punti di ingresso getOptions() e open() di matSelectHarness e aggiungi un feedback equivalente quando vengono richieste opzioni mentre è chiuso. Il lavoro è completato quando la chiamata nello stato chiuso segnala che open() è richiesto invece di restituire un array vuoto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- developer-experience, testing
- Tipo di issue
- Funzionalità
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100