feat(mat-select): Improve mat-select harness DX

Open Beginner friendly
#26,986 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
angular, typescript

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.

Description

area: material/select feature P4
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.

Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 2h
Merged PRs (30d)
81

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/components

All issues in angular/components

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.