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(cdk/testing): incorrectly handling ancestor of compound selector #22476

Merged

Conversation

crisbeto
Copy link
Member

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.

@crisbeto crisbeto added P2 The issue is important to a large percentage of users, with a workaround G This is is related to a Google internal issue target: patch This PR is targeted for the next patch release labels Apr 14, 2021
@crisbeto crisbeto requested a review from mmalerba April 14, 2021 06:04
@crisbeto crisbeto requested a review from devversion as a code owner April 14, 2021 06:04
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 14, 2021
@crisbeto crisbeto force-pushed the 22475/harness-compound-ancestor-selector branch from 13d0089 to 2ae897c Compare April 14, 2021 19:58
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 crisbeto force-pushed the 22475/harness-compound-ancestor-selector branch from 2ae897c to d46e47b Compare April 14, 2021 20:00
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Apr 14, 2021
@mmalerba mmalerba merged commit 032feef into angular:master May 7, 2021
mmalerba pushed a commit that referenced this pull request 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 pull request 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)
@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 Jun 7, 2021
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: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HarnessPredicate doesn't correctly apply ancestor selectors to compound component selectors
3 participants