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

bug(MatChipHarness): Chip Text contains "cancel" #20503

Closed
mischkl opened this issue Sep 7, 2020 · 3 comments · Fixed by #20508
Closed

bug(MatChipHarness): Chip Text contains "cancel" #20503

mischkl opened this issue Sep 7, 2020 · 3 comments · Fixed by #20508
Assignees
Labels
area: material/testing P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@mischkl
Copy link

mischkl commented Sep 7, 2020

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/components-issue

Steps to reproduce:

  1. Create a chip list with cancel buttons, as in autocomplete example https://stackblitz.com/angular/lmgdmgnkkxbb?file=src%2Fapp%2Fchips-autocomplete-example.ts
  2. Get MatChipListHarness, call "getChips()" on it and then "getText()" on one of the chip harnesses.

Expected Behavior

What behavior were you expecting to see?

Text of chip includes only the label, e.g. "Lemon".

Actual Behavior

What behavior did you actually see?

Text of chip includes "cancel" text from within the mat-icon as well, e.g. "Lemoncancel".

Environment

  • Angular: 10.1.0
  • CDK/Material: 10.2.0
  • Browser(s): Chrome 85
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS
@mischkl mischkl added the needs triage This issue needs to be triaged by the team label Sep 7, 2020
@mischkl mischkl changed the title bug(MatChipListHarness): Chip Text contains "cancel" bug(MatChipHarness): Chip Text contains "cancel" Sep 7, 2020
@crisbeto crisbeto self-assigned this Sep 7, 2020
@crisbeto crisbeto added area: material/testing has pr P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Sep 7, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 7, 2020
Excludes the text of icons from the result of the `getText` method.

Fixes angular#20503.
@mischkl
Copy link
Author

mischkl commented Sep 8, 2020

Thanks for the quick fix. Took a look at the code and one thing is missing IMHO: exclusion of .mat-icon in addition to .mat-chip-avatar and .mat-chip-trailing-icon. Icons enable use cases such as "Filter chips" and "Action chips" as illustrated here: https://material.io/components/chips#types - therefore this use case should also be taken into account.

@mischkl
Copy link
Author

mischkl commented Sep 8, 2020

Another aspect of this issue discovered today - MatChipHarness.with({ text: 'xyz' }) also doesn't seem to take icons into account! This has also not yet been addressed by the PR, as far as I can tell.

crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 9, 2020
Excludes the text of icons from the result of the `getText` method.

Fixes angular#20503.
wagnermaciel pushed a commit that referenced this issue Sep 15, 2020
Excludes the text of icons from the result of the `getText` method.

Fixes #20503.
wagnermaciel pushed a commit that referenced this issue 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
wagnermaciel pushed a commit to wagnermaciel/components that referenced this issue Jan 14, 2021
Excludes the text of icons from the result of the `getText` method.

Fixes angular#20503.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/testing P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants