-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(testing): add methods for accessing projected content in component container harnesses #20556
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
refactor(testing): add methods for accessing projected content in component container harnesses #20556
Conversation
…ponent container harnesses Switches over all the harnesses for components that can contain projected user content to extend `ContentContainerComponentHarness` which will allow consumers to query for harnesses inside the element. I've also deprecated a few similar methods that were added before `ContentContainerComponentHarness` was available. That being said, I wasn't totally sure whether the testing APIs fall under the same deprecation policy as everything else so I played it safe. Finally, I cleaned up some `@dynamic` annotations which weren't doing anything, as far as I could tell.
4fa28ad
to
ce65f84
Compare
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.
LGTM
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.
LGTM. (I reviewed this morning but forgot submitting..)
import {coerceBooleanProperty} from '@angular/cdk/coercion'; | ||
import {MenuHarnessFilters, MenuItemHarnessFilters} from '@angular/material/menu/testing'; | ||
|
||
/** Harness for interacting with an MDC-based mat-menu in tests. */ | ||
export class MatMenuHarness extends ComponentHarness { | ||
export class MatMenuHarness extends ContentContainerComponentHarness<string> { |
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.
Should we implement
ContentContainerComponentHarness
rather? (for all similar harnesses too). That would help us enforce the methods being properly overridden and a consistent signature/API. Also looks like the base class isn't used at runtime anyway.
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'll do a follow-up to try and make it so we don't have to override these methods, but we pass in something through the constructor instead.
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.
Sounds great 👍
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. |
Switches over all the harnesses for components that can contain projected user content to extend
ContentContainerComponentHarness
which will allow consumers to query for harnesses inside the element.I've also deprecated a few similar methods that were added before
ContentContainerComponentHarness
was available. That being said, I wasn't totally sure whether the testing APIs fall under the same deprecation policy as everything else so I played it safe.Finally, I cleaned up some
@dynamic
annotations which weren't doing anything, as far as I could tell.