Skip to content

Commit 9df4134

Browse files
committed
test(cdk-experimental/ui-patterns): combobox unit tests
1 parent ef511a3 commit 9df4134

File tree

6 files changed

+974
-35
lines changed

6 files changed

+974
-35
lines changed

src/cdk-experimental/tree/tree.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,21 +330,13 @@ export class CdkTreeItemGroup<V> implements OnInit, OnDestroy, HasElement {
330330
/** Tree item that owns the group. */
331331
readonly ownedBy = input.required<CdkTreeItem<V>>();
332332

333-
/** The combobox that the input belongs to. */
334-
// readonly combobox = inject(CdkCombobox);
335-
336333
constructor() {
337334
this._deferredContentAware.preserveContent.set(true);
338335
// Connect the group's hidden state to the DeferredContentAware's visibility.
339336
afterRenderEffect(() => {
340-
const tree = this.ownedBy().tree();
341-
if (tree.pattern instanceof ComboboxTreePattern) {
342-
this._deferredContentAware.contentVisible.set(
343-
tree.pattern.inputs.combobox()?.isFocused() ?? false,
344-
);
345-
} else {
346-
this._deferredContentAware.contentVisible.set(this.visible());
347-
}
337+
this.ownedBy().tree().pattern instanceof ComboboxTreePattern
338+
? this._deferredContentAware.contentVisible.set(true)
339+
: this._deferredContentAware.contentVisible.set(this.visible());
348340
});
349341
}
350342

src/cdk-experimental/ui-patterns/combobox/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ts_project(
2323
deps = [
2424
":combobox",
2525
"//:node_modules/@angular/core",
26+
"//src/cdk-experimental/ui-patterns/listbox",
27+
"//src/cdk-experimental/ui-patterns/tree",
2628
"//src/cdk/keycodes",
2729
"//src/cdk/testing/private",
2830
],

0 commit comments

Comments
 (0)