[ACS-11325] remove chevron button from tab order in adf-tree (#12041)

* [ACS-11325] remove chevron button from tab order in adf-tree

* [ACS-11325] add unit tests
This commit is contained in:
Mykyta Maliarchuk
2026-07-08 10:13:39 +02:00
committed by GitHub
parent 45d1818f04
commit 997303e6a7
2 changed files with 23 additions and 1 deletions
@@ -58,7 +58,9 @@
*ngIf="node.hasChildren"
class="adf-tree-expand-collapse-button"
mat-icon-button
matTreeNodeToggle
tabindex="-1"
aria-hidden="true"
(click)="expandCollapseNode(node); $event.stopPropagation()"
>
<mat-progress-spinner
mode="indeterminate"
@@ -213,6 +213,26 @@ describe('TreeComponent', () => {
expect(expandSpy).toHaveBeenCalledWith(component.treeService.treeNodes[0], treeNodesMockExpanded);
});
it('should call expandCollapseNode once when chevron is clicked', () => {
component.refreshTree();
fixture.detectChanges();
component.treeService.treeNodes = Array.from(treeNodesMock);
component.treeService.treeNodes[0].isLoading = false;
fixture.detectChanges();
const expandCollapseNodeSpy = spyOn(component, 'expandCollapseNode').and.callThrough();
clickExpandCollapseBtn(component.treeService.treeNodes[0].id);
expect(expandCollapseNodeSpy).toHaveBeenCalledOnceWith(component.treeService.treeNodes[0]);
});
it('should not trigger node selection when chevron is clicked and selectableNodes is true', () => {
component.selectableNodes = true;
component.refreshTree();
fixture.detectChanges();
const onNodeSelectedSpy = spyOn(component, 'onNodeSelected');
clickExpandCollapseBtn(component.treeService.treeNodes[0].id);
expect(onNodeSelectedSpy).not.toHaveBeenCalled();
});
it('should call collapseNode on TreeService when collapsing node by clicking at node label and node has children', () => {
component.refreshTree();
fixture.detectChanges();