AAE-1938 - added first stack of visibility tests for form (#5489)

* AAE-1938 - added first stack of visibility tests for form

* AAE-1938 - fixed unit test after form service changes

* AAE-1938 - rebased with last development

* AAE-1938 - fixed failing e2e

* AAE-1938 - fixed mock definition to match updated service behaviour

* Fixed failing e2e

* AAE-1938 - try to fix cancel uploads
This commit is contained in:
Vito
2020-02-26 14:46:01 +00:00
committed by GitHub
parent 6ef07fe73f
commit 1e67f50346
9 changed files with 2578 additions and 1930 deletions

View File

@@ -70,10 +70,21 @@ export class InMemoryFormService extends FormService {
parseForm(json: any, data?: FormValues, readOnly: boolean = false): FormModel {
if (json) {
const form = new FormModel(json, data, readOnly, this);
const flattenForm = {
...json.formRepresentation,
...json.formRepresentation.formDefinition
};
delete flattenForm.formDefinition;
const formValues: FormValues = {};
(data || []).forEach(variable => {
formValues[variable.name] = variable.value;
});
const form = new FormModel(flattenForm, formValues, readOnly, this);
if (!json.fields) {
form.outcomes = [
new FormOutcomeModel(form, {
new FormOutcomeModel(<any> form, {
id: '$save',
name: FormOutcomeModel.SAVE_ACTION,
isSystem: true