-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(material-experimental): use harnesses for mat-option #17009
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments below
src/material-experimental/mdc-autocomplete/harness/option-harness.ts
Outdated
Show resolved
Hide resolved
src/material-experimental/mdc-autocomplete/harness/option-harness.ts
Outdated
Show resolved
Hide resolved
src/material-experimental/mdc-autocomplete/harness/option-harness.ts
Outdated
Show resolved
Hide resolved
3979a6f
to
b3348e9
Compare
Sorry for the delay @mmalerba, I must've missed the notification. The feedback is addressed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that BaseHarnessFilters
has some built-in options, we should give all classes a static with
function. This will allow users to filter based on selector or ancestor element
Follow-up from angular#16620 and angular#16710. Adds a dedicated harness for `mat-option` and `mat-optgroup`. Note that some of the code is duplicated. This is because we don't have a shared place where to put the harness so that `mat-autocomplete` and `mat-select` don't have to depend on each other. I've intentionally kept the harnesses to only the methods we need, but once we have `experimental/core`, I'll combine them and implement all of the states that are supported by `mat-option`.
b3348e9
to
31626e7
Compare
@mmalerba I've addressed the latest set of feedback. |
@@ -85,12 +86,12 @@ export class MatSelectHarness extends ComponentHarness { | |||
} | |||
|
|||
/** Gets the options inside the select panel. */ | |||
async getOptions(): Promise<TestElement[]> { | |||
async getOptions(): Promise<MatSelectOptionHarness[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we want to make this optionally take a HarnessPredicate
? I seem to remember discussing that at some point. So we can search for a specific option more easily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what that would look like. Here's what I got to compile, but it feels a little weird so I don't know if it's correct:
async getOptions(predicate?: HarnessPredicate<MatSelectOptionHarness>): Promise<MatSelectOptionHarness[]> {
return this._documentRootLocator.locatorForAll(predicate || MatSelectOptionHarness)();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think I meant OptionHarnessFilters
not HarnessPredicate
. That way people can do getOptions({text: 'Option 1'})
. Under the hood that would use a harness predicate: ...locatorForAll(MatSelectOptions.with(options))
. My bad for not explaining that right
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Follow-up from #16620 and #16710. Adds a dedicated harness for
mat-option
andmat-optgroup
.Note that some of the code is duplicated. This is because we don't have a shared place where to put the harness so that
mat-autocomplete
andmat-select
don't have to depend on each other. I've intentionally kept the harnesses to only the methods we need, but once we haveexperimental/core
, I'll combine them and implement all of the states that are supported bymat-option
.