Skip to content

Commit

Permalink
[ADF-5363] - when aspects has no name we will show the id instead
Browse files Browse the repository at this point in the history
  • Loading branch information
VitoAlbano committed Apr 6, 2021
1 parent 39255ab commit 462b15d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
@@ -1,18 +1,18 @@
<div id="aspect-list-container" class="adf-aspect-list-container" *ngIf="aspects$ | async as aspects; else loading">
<mat-accordion class="adf-accordion-aspect-list">
<mat-expansion-panel *ngFor="let aspect of aspects; let colIndex = index" [id]="'aspect-list-'+aspect?.entry?.title">
<mat-expansion-panel-header [id]="'aspect-list-'+aspect?.entry?.title+'header'">
<mat-expansion-panel *ngFor="let aspect of aspects; let colIndex = index" [id]="'aspect-list-'+(aspect?.entry?.title ? aspect?.entry?.title : aspect?.entry?.id.replace(':', '-'))">
<mat-expansion-panel-header [id]="'aspect-list-'+(aspect?.entry?.title ? aspect?.entry?.title : aspect?.entry?.id.replace(':', '-'))+'header'">
<mat-panel-title>
<mat-checkbox class="adf-aspect-list-check-button" [id]="'aspect-list-'+colIndex+'-check'"
[checked]="nodeAspects?.includes(aspect?.entry?.id)"
(click)="onCheckBoxClick($event)"
(change)="onChange($event, aspect?.entry?.id)">
</mat-checkbox>
<p class="adf-aspect-list-element-title">{{aspect?.entry?.title}}</p>
<p class="adf-aspect-list-element-title">{{aspect?.entry?.title ? aspect?.entry?.title : aspect?.entry?.id}}</p>
</mat-panel-title>
<mat-panel-description [id]="'aspect-list-'+colIndex+'-title'"
[matTooltip]="aspect?.entry?.title">
{{aspect?.entry?.title}}
[matTooltip]="(aspect?.entry?.title ? aspect?.entry?.title : aspect?.entry?.id)">
{{aspect?.entry?.title ? aspect?.entry?.title : aspect?.entry?.id}}
</mat-panel-description>
</mat-expansion-panel-header>
<p class="adf-property-paragraph" [id]="'aspect-list-'+colIndex+'-description'"> {{aspect?.entry?.description}}</p>
Expand Down
Expand Up @@ -85,6 +85,21 @@ const customAspectListMock: AspectEntry[] = [{
}
]
}
},
{
entry: {
parentId: 'cst:nonamedAspect',
id: 'cst:nonamedAspect',
description: '',
title: '',
properties: [
{
id: 'channelPassword',
title: 'The authenticated channel password',
dataType: 'd:propA'
}
]
}
}];

describe('AspectListComponent', () => {
Expand Down Expand Up @@ -151,6 +166,13 @@ describe('AspectListComponent', () => {
expect(secondElement).toBeDefined();
});

it('should show aspect id when name or title is not set', () => {
const noNameAspect: HTMLElement = fixture.nativeElement.querySelector('#aspect-list-cst-nonamedAspect .adf-aspect-list-element-title');
expect(noNameAspect).toBeDefined();
expect(noNameAspect).not.toBeNull();
expect(noNameAspect.innerText).toBe('cst:nonamedAspect');
});

it('should show the details when a row is clicked', () => {
const firstElement = fixture.nativeElement.querySelector('#aspect-list-FirstAspect');
firstElement.click();
Expand Down

0 comments on commit 462b15d

Please sign in to comment.