Skip to content

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

Merged

Conversation

crisbeto
Copy link
Member

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.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Sep 13, 2020
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 13, 2020
…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.
@crisbeto crisbeto force-pushed the COMP-294/content-container-harnesses branch from 4fa28ad to ce65f84 Compare September 13, 2020 09:24
@mmalerba mmalerba added P2 The issue is important to a large percentage of users, with a workaround and removed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Sep 14, 2020
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

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

LGTM

@mmalerba mmalerba added G This is is related to a Google internal issue action: merge The PR is ready for merge by the caretaker labels Sep 14, 2020
Copy link
Member

@devversion devversion left a 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> {
Copy link
Member

@devversion devversion Sep 14, 2020

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.

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds great 👍

@wagnermaciel wagnermaciel added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Sep 15, 2020
@wagnermaciel wagnermaciel merged commit 8b670ab into angular:master Sep 16, 2020
@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 Oct 17, 2020
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 G This is is related to a Google internal issue P2 The issue is important to a large percentage of users, with a workaround target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants