[ACS-5645] Implemented the changes as per the review comments

This commit is contained in:
Yasa-Nataliya
2023-10-09 20:22:06 +05:30
parent e0f781420e
commit 42aad10c8a
3 changed files with 19 additions and 19 deletions
@@ -16,7 +16,7 @@
{{ 'CORE.METADATA.BASIC.HEADER' | translate }}
</mat-panel-title>
</div>
<button *ngIf="canToggleEdit"
<button *ngIf="hasToggleEdit"
mat-icon-button
(click)="toggleEdit($event, group, buttonType.GeneralInfo)"
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
@@ -70,7 +70,7 @@
</mat-panel-title>
</div>
<div class="adf-tags-buttons">
<button *ngIf="canTagsToggleEdit"
<button *ngIf="hasTagsToggleEdit"
mat-icon-button
(click)="toggleEdit($event, group, buttonType.Tags)"
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
@@ -132,7 +132,7 @@
</mat-panel-title>
</div>
<div class="adf-metadata-categories-title">
<button *ngIf="canCategoriesToggleEdit"
<button *ngIf="hasCategoriesToggleEdit"
mat-icon-button
(click)="toggleEdit($event, group, buttonType.Categories)"
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
@@ -203,7 +203,7 @@
{{ group.title | translate }}
</mat-panel-title>
</div>
<button *ngIf="canGroupToggleEdit(group)"
<button *ngIf="hasGroupToggleEdit(group)"
mat-icon-button
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT' | translate"
@@ -562,12 +562,12 @@ describe('ContentMetadataComponent', () => {
});
});
describe('canToggleEdit', () => {
describe('hasToggleEdit', () => {
it('should return true when editable is false, readOnly is false, and hasAllowableOperations is true', () => {
component.editable = false;
component.readOnly = false;
component.hasAllowableOperations = true;
const result = component.canToggleEdit;
const result = component.hasToggleEdit;
expect(result).toBe(true);
});
@@ -575,22 +575,22 @@ describe('ContentMetadataComponent', () => {
component.editable = true;
component.readOnly = false;
component.hasAllowableOperations = true;
const result = component.canToggleEdit;
const result = component.hasToggleEdit;
expect(result).toBe(false);
});
});
describe('canTagsToggleEdit', () => {
it('should have canTagsToggleEdit property as expected', () => {
describe('hasTagsToggleEdit', () => {
it('should have hasTagsToggleEdit property as expected', () => {
component.editableTags = false;
component.readOnly = false;
component.hasAllowableOperations = true;
fixture.detectChanges();
expect(component.canTagsToggleEdit).toBe(true);
expect(component.hasTagsToggleEdit).toBe(true);
});
});
describe('canGroupToggleEdit', () => {
describe('hasGroupToggleEdit', () => {
it('should return true when group is not editable, not read-only, and has allowable operations', () => {
component.readOnly = false;
component.hasAllowableOperations = true;
@@ -600,17 +600,17 @@ describe('ContentMetadataComponent', () => {
expanded: true,
editable: false
};
const result = component.canGroupToggleEdit(group);
const result = component.hasGroupToggleEdit(group);
expect(result).toBe(true);
});
});
describe('canCategoriesToggleEdit', () => {
it('should have canCategoriesToggleEdit property as expected', () => {
describe('hasCategoriesToggleEdit', () => {
it('should have hasCategoriesToggleEdit property as expected', () => {
component.editableCategories = false;
component.readOnly = false;
component.hasAllowableOperations = true;
expect(component.canCategoriesToggleEdit).toBe(true);
expect(component.hasCategoriesToggleEdit).toBe(true);
});
});
@@ -449,19 +449,19 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
return !(this.categories.length > 0) && !this.editableCategories;
}
get canToggleEdit(): boolean {
get hasToggleEdit(): boolean {
return !this.editable && !this.readOnly && this.hasAllowableOperations;
}
get canTagsToggleEdit(): boolean {
get hasTagsToggleEdit(): boolean {
return !this.editableTags && !this.readOnly && this.hasAllowableOperations;
}
get canCategoriesToggleEdit(): boolean {
get hasCategoriesToggleEdit(): boolean {
return !this.editableCategories && !this.readOnly && this.hasAllowableOperations;
}
canGroupToggleEdit(group: CardViewGroup): boolean {
hasGroupToggleEdit(group: CardViewGroup): boolean {
return !group.editable && !this.readOnly && this.hasAllowableOperations;
}