mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[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:
@@ -58,7 +58,9 @@
|
|||||||
*ngIf="node.hasChildren"
|
*ngIf="node.hasChildren"
|
||||||
class="adf-tree-expand-collapse-button"
|
class="adf-tree-expand-collapse-button"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
matTreeNodeToggle
|
tabindex="-1"
|
||||||
|
aria-hidden="true"
|
||||||
|
(click)="expandCollapseNode(node); $event.stopPropagation()"
|
||||||
>
|
>
|
||||||
<mat-progress-spinner
|
<mat-progress-spinner
|
||||||
mode="indeterminate"
|
mode="indeterminate"
|
||||||
|
|||||||
@@ -213,6 +213,26 @@ describe('TreeComponent', () => {
|
|||||||
expect(expandSpy).toHaveBeenCalledWith(component.treeService.treeNodes[0], treeNodesMockExpanded);
|
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', () => {
|
it('should call collapseNode on TreeService when collapsing node by clicking at node label and node has children', () => {
|
||||||
component.refreshTree();
|
component.refreshTree();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|||||||
Reference in New Issue
Block a user