mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[MNT-21469] TreeView component has events on icon only (#5637)
* change mat-icon-button with mat-button * align icon and label * fix aria-label undefined value * fix translation * simplify html structure * test
This commit is contained in:
@@ -342,7 +342,10 @@
|
||||
}
|
||||
},
|
||||
"ADF-TREE-VIEW": {
|
||||
"MISSING-ID": "No nodeId provided!"
|
||||
"MISSING-ID": "No nodeId provided!",
|
||||
"ACCESSIBILITY": {
|
||||
"ARIA_LABEL": "Toggle {{ name }}"
|
||||
}
|
||||
},
|
||||
"LIBRARY": {
|
||||
"DIALOG": {
|
||||
|
@@ -8,13 +8,15 @@
|
||||
<mat-tree-node class="adf-tree-view-node"
|
||||
id="{{treeNode.name + '-tree-child-node'}}" *matTreeNodeDef="let treeNode; when: hasChild"
|
||||
matTreeNodePadding [matTreeNodePaddingIndent]="15">
|
||||
<button id="{{'button-'+treeNode.name}}" (click)="onNodeClicked(treeNode.node)"
|
||||
mat-icon-button [attr.aria-label]="'toggle ' + treeNode.filename" matTreeNodeToggle>
|
||||
<button matTreeNodeToggle id="{{'button-'+treeNode.name}}" (click)="onNodeClicked(treeNode.node)"
|
||||
mat-icon-button [attr.aria-label]="'ADF-TREE-VIEW.ACCESSIBILITY.ARIA_LABEL' | translate: {
|
||||
name: treeNode.name
|
||||
}">
|
||||
<mat-icon class="adf-tree-view-icon">
|
||||
{{treeControl.isExpanded(treeNode) ? 'folder_open' : 'folder'}}
|
||||
</mat-icon>
|
||||
</button>
|
||||
{{treeNode.name}}
|
||||
<span class="adf-tree-view-label" matTreeNodeToggle (click)="onNodeClicked(treeNode.node)">{{treeNode.name}}</span>
|
||||
</mat-tree-node>
|
||||
</mat-tree>
|
||||
<ng-template #missingNodeId>
|
||||
|
@@ -13,5 +13,9 @@
|
||||
font-size: 12px;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
&-tree-view-label {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -188,6 +188,16 @@ describe('TreeViewComponent', () => {
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show the subfolders when the label is clicked', async(() => {
|
||||
const rootLabel: HTMLButtonElement = <HTMLButtonElement> element.querySelector('.adf-tree-view-label');
|
||||
rootLabel.click();
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
expect(element.querySelector('#fake-child-name-tree-child-node')).not.toBeNull();
|
||||
expect(element.querySelector('#fake-second-name-tree-child-node')).not.toBeNull();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('When no nodeId is given', () => {
|
||||
|
Reference in New Issue
Block a user