fix readonly form in complete task (#3857)

This commit is contained in:
Eugenio Romano
2018-10-03 19:01:02 +01:00
committed by GitHub
parent 98327be669
commit 488ce948be
5 changed files with 64 additions and 36 deletions

View File

@@ -3,7 +3,7 @@
</ng-content>
</div>
<div *ngIf="hasForm()" class="{{form.className}} adf-form-container">
<div *ngIf="hasForm()" class="{{form.className}} adf-form-container" [ngClass]="{'adf-readonly-form': readOnly }">
<mat-card>
<mat-card-header>
<mat-card-title>
@@ -43,7 +43,7 @@
[disabled]="!isOutcomeButtonEnabled(outcome)"
[class.adf-form-hide-button]="!isOutcomeButtonVisible(outcome, form.readOnly)"
(click)="onOutcomeClicked(outcome)">
{{outcome.name | uppercase | translate}}
{{outcome.name | translate | uppercase }}
</button>
</mat-card-actions>
</mat-card>

View File

@@ -26,7 +26,7 @@
[class.mdl-button--colored]="!outcome.isSystem"
[class.adf-form-hide-button]="!isOutcomeButtonVisible(outcome, form.readOnly)"
(click)="onOutcomeClicked(outcome)">
{{outcome.name| uppercase | translate}}
{{ outcome.name | translate | uppercase}}
</button>
</mat-card-content>
<mat-card-actions *ngIf="showRefreshButton">

View File

@@ -54,13 +54,13 @@
mat-button
(click)="cancelStartProcess()"
id="cancel_process">
{{'ADF_PROCESS_LIST.START_PROCESS.FORM.ACTION.CANCEL'| translate}}
{{'ADF_PROCESS_LIST.START_PROCESS.FORM.ACTION.CANCEL'| translate | uppercase}}
</button>
</adf-start-form>
</mat-card-content>
<mat-card-content *ngIf="hasErrorMessage()">
<mat-card-subtitle class="error-message" id="no-process-message">
{{'ADF_PROCESS_LIST.START_PROCESS.NO_PROCESS_DEFINITIONS' | translate}}
{{'ADF_PROCESS_LIST.START_PROCESS.NO_PROCESS_DEFINITIONS' | translate | uppercase}}
</mat-card-subtitle>
</mat-card-content>
<mat-card-actions *ngIf="!hasStartForm()">
@@ -69,7 +69,7 @@
*ngIf="!hasStartForm()"
(click)="cancelStartProcess()"
id="cancel_process">
{{'ADF_PROCESS_LIST.START_PROCESS.FORM.ACTION.CANCEL'| translate}}
{{'ADF_PROCESS_LIST.START_PROCESS.FORM.ACTION.CANCEL'| translate | uppercase}}
</button>
<button
color="primary"
@@ -80,7 +80,7 @@
data-automation-id="btn-start"
id="button-start"
class="btn-start">
{{'ADF_PROCESS_LIST.START_PROCESS.FORM.ACTION.START' | translate}}
{{'ADF_PROCESS_LIST.START_PROCESS.FORM.ACTION.START' | translate | uppercase}}
</button>
</mat-card-actions>
</mat-card>

View File

@@ -30,7 +30,7 @@
[showCompleteButton]="showFormCompleteButton"
[disableCompleteButton]="!isCompleteButtonEnabled()"
[showSaveButton]="isSaveButtonVisible()"
[readOnly]="readOnlyForm"
[readOnly]="internalReadOnlyForm"
[fieldValidators]="fieldValidators"
(formSaved)='onFormSaved($event)'
(formCompleted)='onFormCompleted($event)'
@@ -103,7 +103,7 @@
</adf-task-header>
<adf-people *ngIf="showInvolvePeople" #people
[people]="taskPeople"
[readOnly]="readOnlyForm"
[readOnly]="internalReadOnlyForm"
[taskId]="taskDetails.id">
</adf-people>
</adf-info-drawer-tab>

View File

@@ -20,12 +20,27 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { of, throwError } from 'rxjs';
import { FormModel, FormOutcomeEvent, FormOutcomeModel, FormService, setupTestBed, BpmUserService } from '@alfresco/adf-core';
import {
FormModel,
FormOutcomeEvent,
FormOutcomeModel,
FormService,
setupTestBed,
BpmUserService
} from '@alfresco/adf-core';
import { CommentProcessService, LogService, AuthenticationService } from '@alfresco/adf-core';
import { UserProcessModel } from '@alfresco/adf-core';
import { TaskDetailsModel } from '../models/task-details.model';
import { noDataMock, taskDetailsMock, standaloneTaskWithForm, standaloneTaskWithoutForm, taskFormMock, tasksMock, taskDetailsWithOutAssigneeMock } from '../../mock';
import {
noDataMock,
taskDetailsMock,
standaloneTaskWithForm,
standaloneTaskWithoutForm,
taskFormMock,
tasksMock,
taskDetailsWithOutAssigneeMock
} from '../../mock';
import { TaskListService } from './../services/tasklist.service';
import { TaskDetailsComponent } from './task-details.component';
import { ProcessTestingModule } from '../../testing/process.testing.module';
@@ -130,12 +145,25 @@ describe('TaskDetailsComponent', () => {
expect(fixture.nativeElement.innerText).toBe('ADF_TASK_LIST.DETAILS.MESSAGES.NONE');
});
it('shoud display a form when the task has an associated form', () => {
it('shoud display a form when the task has an associated form', (done) => {
component.taskId = '123';
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.debugElement.query(By.css('adf-form'))).not.toBeNull();
done();
});
});
it('shoud display a form in readonly when the task has an associated form and readOnlyForm is true', (done) => {
component.readOnlyForm = true;
component.taskId = '123';
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.debugElement.query(By.css('adf-form'))).not.toBeNull();
expect(fixture.debugElement.query(By.css('.adf-readonly-form'))).not.toBeNull();
done();
});
});