[ADF-1826] Task Header - The priority property should be editable (#2768)

* [ADF-1826] Task Header - The priority property should be editable

* [ADF-1826] - Fixed isEditble typo

* [ADF-1826] - Adding unit test - checking the priority value is displayed

* [ADF-1826] fixed unit test

* [ADF-1826] fixed unit test (replaced fit with it)
This commit is contained in:
mihai sirghe 2017-12-06 22:46:28 +02:00 committed by Maurizio Vitale
parent 791e443a72
commit 321c4f48e1
5 changed files with 14 additions and 5 deletions

View File

@ -231,7 +231,7 @@ export class CardViewStarDateItemComponent {
constructor(private cardViewUpdateService: CardViewUpdateService) {} constructor(private cardViewUpdateService: CardViewUpdateService) {}
isEditble() { isEditable() {
return this.editable && this.property.editable; return this.editable && this.property.editable;
} }

View File

@ -1,6 +1,6 @@
<div class="adf-property-label">{{ property.label | translate }}</div> <div class="adf-property-label">{{ property.label | translate }}</div>
<div class="adf-property-value"> <div class="adf-property-value">
<span *ngIf="!isEditble()"> <span *ngIf="!isEditable()">
<span *ngIf="!isClickable(); else elseBlock" [attr.data-automation-id]="'card-textitem-value-' + property.key"> <span *ngIf="!isClickable(); else elseBlock" [attr.data-automation-id]="'card-textitem-value-' + property.key">
<span *ngIf="!property.isEmpty(); else elseEmptyValueBlock">{{ property.displayValue }}</span> <span *ngIf="!property.isEmpty(); else elseEmptyValueBlock">{{ property.displayValue }}</span>
</span> </span>
@ -10,7 +10,7 @@
</span> </span>
</ng-template> </ng-template>
</span> </span>
<span *ngIf="isEditble()"> <span *ngIf="isEditable()">
<div *ngIf="!inEdit" (click)="setEditMode(true)" class="adf-textitem-readonly" [attr.data-automation-id]="'card-textitem-edit-toggle-' + property.key" fxLayout="row" fxLayoutAlign="space-between center"> <div *ngIf="!inEdit" (click)="setEditMode(true)" class="adf-textitem-readonly" [attr.data-automation-id]="'card-textitem-edit-toggle-' + property.key" fxLayout="row" fxLayoutAlign="space-between center">
<span [attr.data-automation-id]="'card-textitem-value-' + property.key"> <span [attr.data-automation-id]="'card-textitem-value-' + property.key">
<span *ngIf="!property.isEmpty(); else elseEmptyValueBlock">{{ property.displayValue }}</span> <span *ngIf="!property.isEmpty(); else elseEmptyValueBlock">{{ property.displayValue }}</span>

View File

@ -43,7 +43,7 @@ export class CardViewTextItemComponent implements OnChanges {
this.editedValue = this.property.value; this.editedValue = this.property.value;
} }
isEditble() { isEditable() {
return this.editable && this.property.editable; return this.editable && this.property.editable;
} }

View File

@ -107,6 +107,14 @@ describe('TaskHeaderComponent', () => {
expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams'); expect(formNameEl.nativeElement.innerText).toBe('Wilbur Adams');
}); });
it('should display priority', () => {
component.taskDetails.priority = 27;
component.ngOnChanges({});
fixture.detectChanges();
let formNameEl = fixture.debugElement.query(By.css('[data-automation-id="card-textitem-value-priority"]'));
expect(formNameEl.nativeElement.innerText).toBe('27');
});
it('should set editable to false if the task has already completed', () => { it('should set editable to false if the task has already completed', () => {
component.taskDetails.endDate = new Date('05/05/2002'); component.taskDetails.endDate = new Date('05/05/2002');
component.ngOnChanges({}); component.ngOnChanges({});

View File

@ -86,7 +86,8 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
{ {
label: 'ADF_TASK_LIST.PROPERTIES.PRIORITY', label: 'ADF_TASK_LIST.PROPERTIES.PRIORITY',
value: this.taskDetails.priority, value: this.taskDetails.priority,
key: 'priority' key: 'priority',
editable: true
} }
), ),
new CardViewDateItemModel( new CardViewDateItemModel(