-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(cdk/tree): add tests for the new cdk/tree APIs #24500
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
feat(cdk/tree): add tests for the new cdk/tree APIs #24500
Conversation
660fd06
to
20086c9
Compare
20086c9
to
5316c3c
Compare
db63ba5
to
b027a6a
Compare
8b3a358
to
3a91226
Compare
b027a6a
to
7f79601
Compare
@andrewseguin this is a straight migration of the existing tests just using the non-deprecated APIs |
@@ -450,7 +450,7 @@ export class CdkTree<T, K = T> implements AfterContentChecked, CollectionViewer, | |||
} else if (this._expansionModel) { | |||
const expansionModel = this._expansionModel; | |||
this._getAllDescendants() | |||
.pipe(take(1), takeUntil(this._onDestroy)) | |||
.pipe(takeUntil(this._onDestroy)) |
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.
This seems like a strange change - wouldn't this only want to take one look at the descendants? Would this emit multiple times over the course of the component?
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.
_getAllDecendants
emits multiple times, but does only call getDescendants
once per node
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.
Could you add a comment here (above this._getAllDescendants()
) that explains what's happening here?
My mental model here is that _getAllDescendants
is an observable because descendants may change over time, but the expandAll
and collapseAll
operations happen at a single point in time. My expectation would be that you would still want take(1)
here with _getAllDescendants
not emitting until it has accumulated all nodes.
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 added a text blurb above the _getAllDescendants
function instead, does that clarify things?
@@ -450,7 +450,7 @@ export class CdkTree<T, K = T> implements AfterContentChecked, CollectionViewer, | |||
} else if (this._expansionModel) { | |||
const expansionModel = this._expansionModel; | |||
this._getAllDescendants() | |||
.pipe(take(1), takeUntil(this._onDestroy)) | |||
.pipe(takeUntil(this._onDestroy)) |
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.
Could you add a comment here (above this._getAllDescendants()
) that explains what's happening here?
My mental model here is that _getAllDescendants
is an observable because descendants may change over time, but the expandAll
and collapseAll
operations happen at a single point in time. My expectation would be that you would still want take(1)
here with _getAllDescendants
not emitting until it has accumulated all nodes.
0ec5a71
to
29e3bb8
Compare
29e3bb8
to
0ff7739
Compare
565eb38
to
fbe321d
Compare
26182bf
to
148aa0d
Compare
Run |
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. |
Followed by #25729.