diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts index 7c3a4c14cc..e033b20fb0 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.spec.ts @@ -213,4 +213,14 @@ describe('StartTaskCloudComponent', () => { fixture.detectChanges(); expect(name.valid).toBeTruthy(); }); + it('should emit error when description have only white spaces', () => { + fixture.detectChanges(); + let description = component.taskForm.controls['description']; + description.setValue(' '); + fixture.detectChanges(); + expect(description.valid).toBeFalsy(); + description.setValue(''); + fixture.detectChanges(); + expect(description.valid).toBeTruthy(); + }); }); diff --git a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.ts b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.ts index 7f18cd8476..53087ac2b3 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/start-task/components/start-task-cloud.component.ts @@ -131,7 +131,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy { this.taskForm = this.formBuilder.group({ name: new FormControl(this.name, [Validators.required, Validators.maxLength(this.getMaxNameLength()), this.whitespaceValidator]), priority: new FormControl(), - description: new FormControl() + description: new FormControl('', [this.whitespaceValidator]) }); } @@ -206,7 +206,7 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy { public whitespaceValidator(control: FormControl) { const isWhitespace = (control.value || '').trim().length === 0; - const isValid = !isWhitespace; + const isValid = control.value.length === 0 || !isWhitespace; return isValid ? null : { 'whitespace': true }; } @@ -217,5 +217,4 @@ export class StartTaskCloudComponent implements OnInit, OnDestroy { get priorityController(): AbstractControl { return this.taskForm.get('priority'); } - }