Skip to content

Commit d237e90

Browse files
committed
add test for material/tree
1 parent bad571b commit d237e90

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/material/tree/node.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const _MatTreeNodeMixinBase: HasTabIndexCtor & CanDisableCtor & typeof CdkTreeNo
4444
inputs: ['disabled', 'tabIndex'],
4545
host: {
4646
'[attr.aria-expanded]': 'isExpanded',
47-
'[attr.aria-level]': 'level + 1',
4847
'[attr.role]': 'role',
4948
'class': 'mat-tree-node'
5049
},

src/material/tree/tree.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,20 @@ describe('MatTree', () => {
349349
[_, _, `topping_6 - cheese_6 + base_6`],
350350
[`topping_3 - cheese_3 + base_3`]);
351351
});
352+
353+
it('with correct aria-level', () => {
354+
expect(getNodes(treeElement).every(node => {
355+
return node.getAttribute('aria-level') === '1';
356+
})).toBe(true);
357+
358+
let data = underlyingDataSource.data;
359+
const child = underlyingDataSource.addChild(data[1]);
360+
underlyingDataSource.addChild(child);
361+
fixture.detectChanges();
362+
363+
const ariaLevels = getNodes(treeElement).map(n => n.getAttribute('aria-level'));
364+
expect(ariaLevels).toEqual(['1', '1', '2', '3', '1']);
365+
});
352366
});
353367

354368
describe('with when node', () => {

0 commit comments

Comments
 (0)