[MNT-22003] - fixed check on variable for visibility service (#6306)

* [MNT-22003] - fixed check on variable for visibility service

* [MNT-22003] - update variable for test

* [MNT-22003] - added extra unit test for checking the process variable passed

Co-authored-by: Vito Albano <vitoalbano@vitoalbano-mbp-0120.local>
This commit is contained in:
Vito
2020-11-04 15:52:12 +00:00
committed by GitHub
parent 66b51a7c93
commit 9c1b6dbc69
5 changed files with 73 additions and 6 deletions

View File

@@ -205,7 +205,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
this.data = data[1];
const parsedForm = this.parseForm(this.formCloudRepresentationJSON);
this.visibilityService.refreshVisibility(<any> parsedForm);
this.visibilityService.refreshVisibility(<any> parsedForm, this.data);
parsedForm.validateForm();
this.form = parsedForm;
this.form.nodeId = '-my-';

View File

@@ -18,8 +18,12 @@
export class TaskVariableCloud {
name: string;
value: any;
type: string;
id: string;
constructor(obj) {
this.id = obj.name || null;
this.name = obj.name || null;
this.value = obj.value || null;
this.type = obj.type || null;
}
}

View File

@@ -264,7 +264,8 @@ describe('StartProcessCloudComponent', () => {
it('should be able to start a process with a prefilled valid form', fakeAsync(() => {
component.processDefinitionName = 'processwithform';
getDefinitionsSpy.and.returnValue(of(fakeSingleProcessDefinition(component.processDefinitionName)));
component.values = [{ 'name': 'firstName', 'value': 'FakeName' }, {
component.values = [{'id': '1', 'type': 'string', 'name': 'firstName', 'value': 'FakeName' }, {
'id': '1', 'type': 'string',
'name': 'lastName',
'value': 'FakeLastName'
}];
@@ -298,7 +299,8 @@ describe('StartProcessCloudComponent', () => {
it('should NOT be able to start a process with a prefilled NOT valid form', fakeAsync(() => {
component.processDefinitionName = 'processwithform';
getDefinitionsSpy.and.returnValue(of(fakeSingleProcessDefinition(component.processDefinitionName)));
component.values = [{ 'name': 'firstName', 'value': 'FakeName' }, {
component.values = [{ 'id': '1', 'type': 'string', 'name': 'firstName', 'value': 'FakeName' }, {
'id': '1', 'type': 'string',
'name': 'lastName',
'value': 'FakeLastName'
}];
@@ -331,7 +333,8 @@ describe('StartProcessCloudComponent', () => {
}));
it('should create a process instance if the selection is valid', fakeAsync(() => {
component.values = [{ 'name': 'firstName', 'value': 'FakeName' }, {
component.values = [{ 'id': '1', 'type': 'string', 'name': 'firstName', 'value': 'FakeName' }, {
'id': '1', 'type': 'string',
'name': 'lastName',
'value': 'FakeLastName'
}];
@@ -362,7 +365,8 @@ describe('StartProcessCloudComponent', () => {
}));
it('should have start button enabled when default values are set', fakeAsync(() => {
component.values = [{ 'name': 'firstName', 'value': 'FakeName' }, {
component.values = [{ 'id': '1', 'type': 'string', 'name': 'firstName', 'value': 'FakeName' }, {
'id': '1', 'type': 'string',
'name': 'lastName',
'value': 'FakeLastName'
}];