-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Conversation
There was a problem hiding this 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
ab13903
to
21876af
Compare
594fb9b
to
90785d3
Compare
src/cdk/testing/dom-helpers.ts
Outdated
@@ -0,0 +1,9 @@ | |||
export function getTextWithExcludedElements(element: Element, excludeSelector: string) { |
There was a problem hiding this comment.
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
src/cdk/testing/dom-helpers.ts
Outdated
child.parentNode?.removeChild(child); | ||
} | ||
return (clone.textContent || '').trim(); | ||
} |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/cdk/testing/text-filtering.ts
Outdated
@@ -0,0 +1,9 @@ | |||
export function getTextWithExcludedElements(element: Element, excludeSelector: string) { |
There was a problem hiding this comment.
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
9d1d5e6
to
ad34d0e
Compare
ad34d0e
to
d5c2dcd
Compare
There was a problem hiding this 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
d37d7b8
to
a5d6b28
Compare
a5d6b28
to
78fa003
Compare
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. |
No description provided.