Skip to content

Commit

Permalink
[ACS-7982] ACC - fix categories tree (#9715)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-web-ua authored May 23, 2024
1 parent 9d7e815 commit a9e9342
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 4 additions & 9 deletions lib/content-services/src/lib/tree/components/tree.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,15 @@
*matTreeNodeDef="let node when isLoadMoreNode"
matTreeNodePadding>
<div class="adf-tree-expand-collapse-container">
<button class="adf-tree-load-more-button" mat-icon-button>
<button class="adf-tree-load-more-button" mat-icon-button (click)="loadMoreSubnodes(node)">
<mat-progress-spinner
color="primary"
mode="indeterminate"
[diameter]="24"
*ngIf="node.isLoading; else loadMoreIcon">
</mat-progress-spinner>
<ng-template #loadMoreIcon>
<adf-icon
[value]="'chevron_right'"
(click)="loadMoreSubnodes(node)">
</adf-icon>
<adf-icon [value]="'chevron_right'"></adf-icon>
</ng-template>
</button>
</div>
Expand All @@ -54,6 +51,7 @@
<div class="adf-tree-expand-collapse-container">
<button *ngIf="node.hasChildren"
class="adf-tree-expand-collapse-button"
(click)="expandCollapseNode(node)"
mat-icon-button>
<mat-progress-spinner
color="primary"
Expand All @@ -62,10 +60,7 @@
*ngIf="node.isLoading; else expandCollapseIcon">
</mat-progress-spinner>
<ng-template #expandCollapseIcon>
<adf-icon
[value]="expandCollapseIconValue(node)"
(click)="expandCollapseNode(node)">
</adf-icon>
<adf-icon [value]="expandCollapseIconValue(node)"></adf-icon>
</ng-template>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ describe('TreeComponent', () => {
const getNodeSpinner = async (nodeId: string) =>
loader.getHarnessOrNull(MatProgressSpinnerHarness.with({ ancestor: composeNodeSelector(nodeId) }));

const getExpandCollapseBtn = (nodeId: string) => fixture.nativeElement.querySelector(`${composeNodeSelector(nodeId)} .adf-icon`);
const getExpandCollapseBtn = (nodeId: string) =>
fixture.nativeElement.querySelector(`${composeNodeSelector(nodeId)} .adf-tree-expand-collapse-button`);

const tickCheckbox = (index: number) => {
const selector = `[data-automation-id="${index === 0 ? 'has-children-node-checkbox' : 'no-children-node-checkbox'}"]`;
Expand Down Expand Up @@ -289,7 +290,7 @@ describe('TreeComponent', () => {
component.refreshTree();
fixture.detectChanges();
spyOn(component.treeService, 'getSubNodes').and.returnValue(of({ pagination: {}, entries: Array.from(singleNode) }));
const loadMoreBtn = fixture.debugElement.query(By.css('.adf-tree-load-more-button adf-icon')).nativeElement;
const loadMoreBtn = fixture.debugElement.query(By.css('.adf-tree-load-more-button')).nativeElement;
const appendSpy = spyOn(component.treeService, 'appendNodes').and.callThrough();
loadMoreBtn.dispatchEvent(new Event('click'));
fixture.whenStable();
Expand Down

0 comments on commit a9e9342

Please sign in to comment.