Skip to content

Commit 23884ee

Browse files
committed
logging
1 parent 46571a5 commit 23884ee

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

src/cdk/tree/tree.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ describe('CdkTree', () => {
596596
[`topping_3 - cheese_3 + base_3`]);
597597
});
598598

599-
it('with correct aria-level', () => {
599+
fit('with correct aria-level', () => {
600600
expect(getNodes(treeElement).every(node => {
601601
return node.getAttribute('aria-level') === '1';
602602
})).toBe(true);

src/cdk/tree/tree.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export class CdkTree<T> implements AfterContentChecked, CollectionViewer, OnDest
291291
}
292292
}
293293

294-
294+
let uuid = 0;
295295
/**
296296
* Tree node for CdkTree. It contains the data in the tree node.
297297
*/
@@ -305,6 +305,7 @@ export class CdkTree<T> implements AfterContentChecked, CollectionViewer, OnDest
305305
},
306306
})
307307
export class CdkTreeNode<T> implements FocusableOption, OnDestroy, AfterViewInit {
308+
unique: number;
308309
/**
309310
* The most recently created `CdkTreeNode`. We save it in static variable so we can retrieve it
310311
* in `CdkTree` and set the data to it.
@@ -350,14 +351,18 @@ export class CdkTreeNode<T> implements FocusableOption, OnDestroy, AfterViewInit
350351
constructor(protected _elementRef: ElementRef<HTMLElement>,
351352
protected _tree: CdkTree<T>) {
352353
CdkTreeNode.mostRecentTreeNode = this as CdkTreeNode<T>;
354+
this.unique = uuid++;
355+
console.error(`constructor: node ${this.unique}`)
353356
}
354357

355358
ngAfterViewInit(): void {
356359
this._parentNodeAriaLevel = this._getParentNodeAriaLevel();
360+
console.error(`ngAfterViewInit: node ${this.unique} set aria-level to ${this.level + 1}`)
357361
this._elementRef.nativeElement.setAttribute('aria-level', String(this.level + 1));
358362
}
359363

360364
ngOnDestroy() {
365+
console.error(`ngOnDestroy: node ${this.unique}`)
361366
// If this is the last tree node being destroyed,
362367
// clear out the reference to avoid leaking memory.
363368
if (CdkTreeNode.mostRecentTreeNode === this) {

src/material/tree/node.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class MatTreeNodeDef<T> extends CdkTreeNodeDef<T> {
8888
host: {
8989
'[attr.aria-expanded]': 'isExpanded',
9090
'[attr.role]': 'role',
91-
'class': 'mat-nested-tree-node',
91+
'class': 'mat-nested-tree-node cdk-nested-tree-node',
9292
},
9393
providers: [
9494
{provide: CdkNestedTreeNode, useExisting: MatNestedTreeNode},
@@ -126,13 +126,13 @@ export class MatNestedTreeNode<T> extends CdkNestedTreeNode<T> implements AfterC
126126
// This is a workaround for https://github.com/angular/angular/issues/23091
127127
// In aot mode, the lifecycle hooks from parent class are not called.
128128
// TODO(tinayuangao): Remove when the angular issue #23091 is fixed
129-
ngAfterContentInit() {
130-
super.ngAfterContentInit();
131-
}
132-
133-
ngOnDestroy() {
134-
super.ngOnDestroy();
135-
}
129+
// ngAfterContentInit() {
130+
// super.ngAfterContentInit();
131+
// }
132+
//
133+
// ngOnDestroy() {
134+
// super.ngOnDestroy();
135+
// }
136136

137137
static ngAcceptInputType_disabled: BooleanInput;
138138
}

src/material/tree/tree.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,12 @@ describe('MatTree', () => {
350350
[`topping_3 - cheese_3 + base_3`]);
351351
});
352352

353-
it('with correct aria-level', () => {
353+
fit('with correct aria-level', () => {
354354
expect(getNodes(treeElement).every(node => {
355355
return node.getAttribute('aria-level') === '1';
356356
})).toBe(true);
357357

358+
debugger;
358359
let data = underlyingDataSource.data;
359360
const child = underlyingDataSource.addChild(data[1]);
360361
underlyingDataSource.addChild(child);

0 commit comments

Comments
 (0)