Skip to content

Commit

Permalink
[ADF-4529] Enable form configuration from e2e tests (Alfresco#4738)
Browse files Browse the repository at this point in the history
* [ADF-4529] Enable form configuration from e2e tests

* Improve linting

* Move form methods to new  file
  • Loading branch information
davidcanonieto authored and eromano committed May 28, 2019
1 parent 36faed0 commit f2f08a5
Show file tree
Hide file tree
Showing 10 changed files with 1,894 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
*/

import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormFieldModel, NotificationService, FormRenderingService } from '@alfresco/adf-core';
import { FormFieldModel, NotificationService, FormRenderingService, CoreAutomationService } from '@alfresco/adf-core';
import { FormCloud, FormCloudService, UploadCloudWidgetComponent } from '@alfresco/adf-process-services-cloud';
import { Subscription } from 'rxjs';
import { formDefinition } from './demo-form';

@Component({
templateUrl: 'cloud-form-demo.component.html',
Expand All @@ -45,7 +44,8 @@ export class FormCloudDemoComponent implements OnInit, OnDestroy {
constructor(
private notificationService: NotificationService,
private formRenderingService: FormRenderingService,
private formService: FormCloudService) {
private formService: FormCloudService,
private automationService: CoreAutomationService) {
this.formRenderingService.setComponentTypeResolver('upload', () => UploadCloudWidgetComponent, true);
}

Expand All @@ -54,7 +54,7 @@ export class FormCloudDemoComponent implements OnInit, OnDestroy {
}

ngOnInit() {
this.formConfig = formDefinition;
this.formConfig = this.automationService.forms.getFormCloudDefinition();
this.parseForm();
}

Expand Down

This file was deleted.

8 changes: 4 additions & 4 deletions demo-shell/src/app/components/form/form-loading.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*/

import { Component, Inject, OnInit } from '@angular/core';
import { FormModel, FormService, FormOutcomeEvent } from '@alfresco/adf-core';
import { FormModel, FormService, FormOutcomeEvent, CoreAutomationService } from '@alfresco/adf-core';
import { InMemoryFormService } from '../../services/in-memory-form.service';
import { DemoForm } from './demo-form';
import { FakeFormService } from './fake-form.service';

@Component({
Expand All @@ -37,15 +36,16 @@ export class FormLoadingComponent implements OnInit {
radioButtonFieldValue = '';
formattedData = {};

constructor(@Inject(FormService) private formService: InMemoryFormService) {
constructor(@Inject(FormService) private formService: InMemoryFormService,
private automationService: CoreAutomationService) {
formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
formOutcomeEvent.preventDefault();
});
}

ngOnInit() {
this.formattedData = {};
const formDefinitionJSON: any = DemoForm.getSimpleFormDefinition();
const formDefinitionJSON: any = this.automationService.forms.getSimpleFormDefinition();
this.form = this.formService.parseForm(formDefinitionJSON);
}

Expand Down
8 changes: 4 additions & 4 deletions demo-shell/src/app/components/form/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*/

import { Component, Inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { FormModel, FormFieldModel, FormService, FormOutcomeEvent, NotificationService } from '@alfresco/adf-core';
import { FormModel, FormFieldModel, FormService, FormOutcomeEvent, NotificationService, CoreAutomationService } from '@alfresco/adf-core';
import { InMemoryFormService } from '../../services/in-memory-form.service';
import { DemoForm } from './demo-form';
import { Subscription } from 'rxjs';

@Component({
Expand Down Expand Up @@ -48,7 +47,8 @@ export class FormComponent implements OnInit, OnDestroy {
};

constructor(@Inject(FormService) private formService: InMemoryFormService,
private notificationService: NotificationService) {
private notificationService: NotificationService,
private automationService: CoreAutomationService) {

this.subscriptions.push(
formService.executeOutcome.subscribe((formOutcomeEvent: FormOutcomeEvent) => {
Expand All @@ -62,7 +62,7 @@ export class FormComponent implements OnInit, OnDestroy {
}

ngOnInit() {
const formDefinitionJSON: any = DemoForm.getDefinition();
const formDefinitionJSON: any = this.automationService.forms.getFormDefinition();
this.formConfig = JSON.stringify(formDefinitionJSON);
this.parseForm();
}
Expand Down
Loading

0 comments on commit f2f08a5

Please sign in to comment.