mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-5645] Implemented the changes as per the review comments
This commit is contained in:
+4
-4
@@ -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"
|
||||
|
||||
+11
-11
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+4
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user