-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
HarnessPredicate doesn't correctly apply ancestor selectors to compound component selectors #22475
Labels
area: cdk/testing
G
This is is related to a Google internal issue
help wanted
The team would appreciate a PR from the community to address this issue
P2
The issue is important to a large percentage of users, with a workaround
Comments
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Apr 14, 2021
Currently the component harness handles the `ancestor` option by prepending it to the `hostSelector` of the harness. This breaks down if the `hostSelector` is a compound selector, because we end up with something like `.parent .a, .b`, rather than `.parent .a, .parent .b`. These changes resolve the issue and add a bit of extra logic to account for the case where the selector might include commas inside quotes which will break us, because we split compound selectors on the comma. The logic is loosely based on my changes from angular/angular#38716. Fixes angular#22475.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Apr 14, 2021
Currently the component harness handles the `ancestor` option by prepending it to the `hostSelector` of the harness. This breaks down if the `hostSelector` is a compound selector, because we end up with something like `.parent .a, .b`, rather than `.parent .a, .parent .b`. These changes resolve the issue and add a bit of extra logic to account for the case where the selector might include commas inside quotes which will break us, because we split compound selectors on the comma. The logic is loosely based on my changes from angular/angular#38716. Fixes angular#22475.
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
Apr 14, 2021
Currently the component harness handles the `ancestor` option by prepending it to the `hostSelector` of the harness. This breaks down if the `hostSelector` is a compound selector, because we end up with something like `.parent .a, .b`, rather than `.parent .a, .parent .b`. These changes resolve the issue and add a bit of extra logic to account for the case where the selector might include commas inside quotes which will break us, because we split compound selectors on the comma. The logic is loosely based on my changes from angular/angular#38716. Fixes angular#22475.
mmalerba
pushed a commit
that referenced
this issue
May 7, 2021
…22476) Currently the component harness handles the `ancestor` option by prepending it to the `hostSelector` of the harness. This breaks down if the `hostSelector` is a compound selector, because we end up with something like `.parent .a, .b`, rather than `.parent .a, .parent .b`. These changes resolve the issue and add a bit of extra logic to account for the case where the selector might include commas inside quotes which will break us, because we split compound selectors on the comma. The logic is loosely based on my changes from angular/angular#38716. Fixes #22475.
mmalerba
pushed a commit
that referenced
this issue
May 7, 2021
…22476) Currently the component harness handles the `ancestor` option by prepending it to the `hostSelector` of the harness. This breaks down if the `hostSelector` is a compound selector, because we end up with something like `.parent .a, .b`, rather than `.parent .a, .parent .b`. These changes resolve the issue and add a bit of extra logic to account for the case where the selector might include commas inside quotes which will break us, because we split compound selectors on the comma. The logic is loosely based on my changes from angular/angular#38716. Fixes #22475. (cherry picked from commit 032feef)
mmalerba
pushed a commit
that referenced
this issue
May 7, 2021
…22476) Currently the component harness handles the `ancestor` option by prepending it to the `hostSelector` of the harness. This breaks down if the `hostSelector` is a compound selector, because we end up with something like `.parent .a, .b`, rather than `.parent .a, .parent .b`. These changes resolve the issue and add a bit of extra logic to account for the case where the selector might include commas inside quotes which will break us, because we split compound selectors on the comma. The logic is loosely based on my changes from angular/angular#38716. Fixes #22475. (cherry picked from commit 032feef)
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area: cdk/testing
G
This is is related to a Google internal issue
help wanted
The team would appreciate a PR from the community to address this issue
P2
The issue is important to a large percentage of users, with a workaround
Note(@jelbourn): Copied from an internal bug report
HarnessPredicate.getSelector returns the wrong result in certain cases. E.g., MatButtonHarness and other CDK harnesses are defined as matching one of several possible selectors:
I would expect
getHarness(MatButtonHarness.with({ancestor: '.foo'}))
to always find a MatButton that has a '.foo' ancestor. However, the current implementation of https://source.corp.google.com/search?q=HarnessPredicate.getSelector returns:which only applies the ancestor constraint to the first possibility.
The text was updated successfully, but these errors were encountered: