Skip to content

feat(cdk/testing): add optional excludes to TestElement text method #20145

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
merged 9 commits into from
Aug 19, 2020

Conversation

annieyw
Copy link
Contributor

@annieyw annieyw commented Jul 30, 2020

No description provided.

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

Also implement the new options for unit and e2e tests, and write tests

@annieyw annieyw requested a review from a team as a code owner July 30, 2020 23:00
@annieyw annieyw force-pushed the get-text-excludes branch from ab13903 to 21876af Compare July 31, 2020 19:16
@annieyw annieyw force-pushed the get-text-excludes branch from 594fb9b to 90785d3 Compare July 31, 2020 21:26
@@ -0,0 +1,9 @@
export function getTextWithExcludedElements(element: Element, excludeSelector: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Much nicer. While you're at it, can you do the same thing for the other usages of browser.executeScript? They're much simpler functions, but would still be nice to have them be typed functions instead of strings

child.parentNode?.removeChild(child);
}
return (clone.textContent || '').trim();
}
Copy link
Member

Choose a reason for hiding this comment

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

On this file name:

Helper is a technical term meaning 'Bad abstraction'

😉

How about text-filtering.ts?

Copy link
Contributor

Choose a reason for hiding this comment

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

That works as long as its just this function here, but I asked her to move some other DOM related stuff here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've renamed it to text-filtering.ts for now but will reorganize the other DOM scripts in a followup

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -0,0 +1,9 @@
export function getTextWithExcludedElements(element: Element, excludeSelector: string) {
Copy link
Member

Choose a reason for hiding this comment

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

I would add a JsDoc description for this function

@annieyw annieyw force-pushed the get-text-excludes branch from 9d1d5e6 to ad34d0e Compare August 3, 2020 19:27
@annieyw annieyw force-pushed the get-text-excludes branch from ad34d0e to d5c2dcd Compare August 3, 2020 19:30
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 aside from the one comment nit

@annieyw annieyw force-pushed the get-text-excludes branch from d37d7b8 to a5d6b28 Compare August 3, 2020 21:47
@annieyw annieyw force-pushed the get-text-excludes branch from a5d6b28 to 78fa003 Compare August 3, 2020 21:51
@annieyw annieyw added target: minor This PR is targeted for the next minor release action: merge The PR is ready for merge by the caretaker labels Aug 3, 2020
@wagnermaciel wagnermaciel merged commit 8eb6754 into angular:master Aug 19, 2020
@annieyw annieyw deleted the get-text-excludes branch August 19, 2020 16:21
@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 Sep 19, 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 target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants