Skip to content

feat(cdk-experimental/testing): Adds a HarnessPredicate class #16319

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

Merged
merged 8 commits into from
Jun 19, 2019

Conversation

mmalerba
Copy link
Contributor

The HarnessPredicate class can be used to more easily search for component instances for a ComponentHarness that meet certain criteria (e.g. get a MatButtonHarness with specific button text).

@mmalerba mmalerba added pr: merge safe target: patch This PR is targeted for the next patch release labels Jun 18, 2019
@mmalerba mmalerba requested review from jelbourn and crisbeto June 18, 2019 19:57
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 18, 2019
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

export class SubComponentHarness extends ComponentHarness {
static readonly hostSelector = 'test-sub';

static with(options: {title?: string | RegExp, itemCount?: number} = {}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an interface for supporting this with pattern to more formally codify it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this pattern and I think that Harness authors should follow it, but the actual options may differ based on the particular harness being implemented, and some harnesses might not even need a with method.

Maybe we can just say its a recommended convention and do it in all of our component harnesses where it makes sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works for me

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jun 19, 2019
@jelbourn jelbourn merged commit 6a7fc81 into angular:master Jun 19, 2019
RudolfFrederiksen pushed a commit to RudolfFrederiksen/material2 that referenced this pull request Jun 21, 2019
…lar#16319)

This enables users of harness authors to provide an API for querying harnesses based on arbitrary state as given by predicate functions.
andrewseguin pushed a commit that referenced this pull request Jul 2, 2019
This enables users of harness authors to provide an API for querying harnesses based on arbitrary state as given by predicate functions.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants