Skip to content
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

fix(chips/testing): exclude icons from getText result #20508

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Sep 7, 2020

Excludes the text of icons from the result of the getText method.

Fixes #20503.

@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 7, 2020
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 7, 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.

Nice! LGTM

@devversion devversion added the action: merge The PR is ready for merge by the caretaker label Sep 7, 2020
@@ -31,7 +31,7 @@ export class MatChipHarness extends ComponentHarness {

/** Gets the text of the chip. */
async getText(): Promise<string> {
return (await this.host()).text();
return (await this.host()).text({exclude: '.mat-chip-avatar, .mat-chip-trailing-icon'});
Copy link

@mischkl mischkl Sep 8, 2020

Choose a reason for hiding this comment

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

Should also exclude .mat-icon, see #20503 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

@crisbeto do you know if we expect people to use mat-icon directly in mat-chip without marking it as an avatar or trailing icon?

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 believe that all our examples go through the avatar or the trailing icon directives. I've added .mat-icon to the selector anyway since it doesn't require any maintenance on our end.

@mmalerba mmalerba removed the action: merge The PR is ready for merge by the caretaker label Sep 9, 2020
Excludes the text of icons from the result of the `getText` method.

Fixes angular#20503.
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Sep 9, 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

@mischkl
Copy link

mischkl commented Sep 10, 2020

Please also see #20503 (comment) - the with() method may also need to be updated.

@crisbeto
Copy link
Member Author

The with method goes through MatChipHarness.getText which will have the exclusion logic once this PR lands.

@wagnermaciel wagnermaciel merged commit 20b4bc9 into angular:master Sep 15, 2020
wagnermaciel pushed a commit that referenced this pull request Sep 15, 2020
Excludes the text of icons from the result of the `getText` method.

Fixes #20503.

(cherry picked from commit 20b4bc9)
@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 16, 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 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(MatChipHarness): Chip Text contains "cancel"
6 participants