diff --git a/demo-shell-ng2/app/components/form/demo-form.ts b/demo-shell-ng2/app/components/form/demo-form.ts
index 5e58ce8e5b..a496247fac 100644
--- a/demo-shell-ng2/app/components/form/demo-form.ts
+++ b/demo-shell-ng2/app/components/form/demo-form.ts
@@ -2,14 +2,14 @@
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
@@ -17,6 +17,343 @@
export class DemoForm {
+ static getEasyForm(): any {
+ return {
+ 'id': 1001,
+ 'name': 'ISSUE_FORM',
+ 'processDefinitionId': 'ISSUE_APP:1:2504',
+ 'processDefinitionName': 'ISSUE_APP',
+ 'processDefinitionKey': 'ISSUE_APP',
+ 'taskId': '2510',
+ 'taskDefinitionKey': 'sid-F67A2996-1684-4774-855A-4591490081FD',
+ 'tabs': [],
+ 'fields': [
+ {
+ 'fieldType': 'ContainerRepresentation',
+ 'id': '1498212398417',
+ 'name': 'Label',
+ 'type': 'container',
+ 'value': null,
+ 'required': false,
+ 'readOnly': false,
+ 'overrideId': false,
+ 'colspan': 1,
+ 'placeholder': null,
+ 'minLength': 0,
+ 'maxLength': 0,
+ 'minValue': null,
+ 'maxValue': null,
+ 'regexPattern': null,
+ 'optionType': null,
+ 'hasEmptyValue': false,
+ 'options': null,
+ 'restUrl': null,
+ 'restResponsePath': null,
+ 'restIdProperty': null,
+ 'restLabelProperty': null,
+ 'tab': null,
+ 'className': null,
+ 'dateDisplayFormat': null,
+ 'sizeX': 2,
+ 'sizeY': 1,
+ 'row': -1,
+ 'col': -1,
+ 'numberOfColumns': 2,
+ 'fields': {
+ '1': [
+ {
+ 'fieldType': 'RestFieldRepresentation',
+ 'id': 'label',
+ 'name': 'Label',
+ 'type': 'dropdown',
+ 'value': 'Choose one...',
+ 'required': false,
+ 'readOnly': false,
+ 'overrideId': false,
+ 'colspan': 1,
+ 'placeholder': null,
+ 'minLength': 0,
+ 'maxLength': 0,
+ 'minValue': null,
+ 'maxValue': null,
+ 'regexPattern': null,
+ 'optionType': null,
+ 'hasEmptyValue': true,
+ 'options': [
+ {
+ 'id': 'empty',
+ 'name': 'Choose one...'
+ },
+ {
+ 'id': 'option_1',
+ 'name': 'test1'
+ },
+ {
+ 'id': 'option_2',
+ 'name': 'test2'
+ },
+ {
+ 'id': 'option_3',
+ 'name': 'test3'
+ }
+ ],
+ 'restUrl': null,
+ 'restResponsePath': null,
+ 'restIdProperty': null,
+ 'restLabelProperty': null,
+ 'tab': null,
+ 'className': null,
+ 'params': {
+ 'existingColspan': 1,
+ 'maxColspan': 2
+ },
+ 'dateDisplayFormat': null,
+ 'layout': {
+ 'row': -1,
+ 'column': -1,
+ 'colspan': 1
+ },
+ 'sizeX': 1,
+ 'sizeY': 1,
+ 'row': -1,
+ 'col': -1,
+ 'visibilityCondition': null,
+ 'endpoint': null,
+ 'requestHeaders': null
+ },
+ {
+ 'fieldType': 'FormFieldRepresentation',
+ 'id': 'Date',
+ 'name': 'Date',
+ 'type': 'date',
+ 'value': null,
+ 'required': false,
+ 'readOnly': false,
+ 'overrideId': false,
+ 'colspan': 1,
+ 'placeholder': null,
+ 'minLength': 0,
+ 'maxLength': 0,
+ 'minValue': null,
+ 'maxValue': null,
+ 'regexPattern': null,
+ 'optionType': null,
+ 'hasEmptyValue': null,
+ 'options': null,
+ 'restUrl': null,
+ 'restResponsePath': null,
+ 'restIdProperty': null,
+ 'restLabelProperty': null,
+ 'tab': 'tab1',
+ 'className': null,
+ 'params': {
+ 'existingColspan': 1,
+ 'maxColspan': 2
+ },
+ 'dateDisplayFormat': null,
+ 'layout': {
+ 'row': -1,
+ 'column': -1,
+ 'colspan': 1
+ },
+ 'sizeX': 1,
+ 'sizeY': 1,
+ 'row': -1,
+ 'col': -1,
+ 'visibilityCondition': null
+ },
+ {
+ 'fieldType': 'FormFieldRepresentation',
+ 'id': 'label5',
+ 'name': 'Label5',
+ 'type': 'boolean',
+ 'value': null,
+ 'required': false,
+ 'readOnly': false,
+ 'overrideId': false,
+ 'colspan': 1,
+ 'placeholder': null,
+ 'minLength': 0,
+ 'maxLength': 0,
+ 'minValue': null,
+ 'maxValue': null,
+ 'regexPattern': null,
+ 'optionType': null,
+ 'hasEmptyValue': null,
+ 'options': null,
+ 'restUrl': null,
+ 'restResponsePath': null,
+ 'restIdProperty': null,
+ 'restLabelProperty': null,
+ 'tab': 'tab1',
+ 'className': null,
+ 'params': {
+ 'existingColspan': 1,
+ 'maxColspan': 1
+ },
+ 'dateDisplayFormat': null,
+ 'layout': {
+ 'row': -1,
+ 'column': -1,
+ 'colspan': 1
+ },
+ 'sizeX': 1,
+ 'sizeY': 1,
+ 'row': -1,
+ 'col': -1,
+ 'visibilityCondition': null
+ },
+ {
+ 'fieldType': 'FormFieldRepresentation',
+ 'id': 'label6',
+ 'name': 'Label6',
+ 'type': 'boolean',
+ 'value': null,
+ 'required': false,
+ 'readOnly': false,
+ 'overrideId': false,
+ 'colspan': 1,
+ 'placeholder': null,
+ 'minLength': 0,
+ 'maxLength': 0,
+ 'minValue': null,
+ 'maxValue': null,
+ 'regexPattern': null,
+ 'optionType': null,
+ 'hasEmptyValue': null,
+ 'options': null,
+ 'restUrl': null,
+ 'restResponsePath': null,
+ 'restIdProperty': null,
+ 'restLabelProperty': null,
+ 'tab': 'tab1',
+ 'className': null,
+ 'params': {
+ 'existingColspan': 1,
+ 'maxColspan': 1
+ },
+ 'dateDisplayFormat': null,
+ 'layout': {
+ 'row': -1,
+ 'column': -1,
+ 'colspan': 1
+ },
+ 'sizeX': 1,
+ 'sizeY': 1,
+ 'row': -1,
+ 'col': -1,
+ 'visibilityCondition': null
+ },
+ {
+ 'fieldType': 'FormFieldRepresentation',
+ 'id': 'label4',
+ 'name': 'Label4',
+ 'type': 'integer',
+ 'value': null,
+ 'required': false,
+ 'readOnly': false,
+ 'overrideId': false,
+ 'colspan': 1,
+ 'placeholder': null,
+ 'minLength': 0,
+ 'maxLength': 0,
+ 'minValue': null,
+ 'maxValue': null,
+ 'regexPattern': null,
+ 'optionType': null,
+ 'hasEmptyValue': null,
+ 'options': null,
+ 'restUrl': null,
+ 'restResponsePath': null,
+ 'restIdProperty': null,
+ 'restLabelProperty': null,
+ 'tab': 'tab1',
+ 'className': null,
+ 'params': {
+ 'existingColspan': 1,
+ 'maxColspan': 2
+ },
+ 'dateDisplayFormat': null,
+ 'layout': {
+ 'row': -1,
+ 'column': -1,
+ 'colspan': 1
+ },
+ 'sizeX': 1,
+ 'sizeY': 1,
+ 'row': -1,
+ 'col': -1,
+ 'visibilityCondition': null
+ },
+ {
+ 'fieldType': 'RestFieldRepresentation',
+ 'id': 'label12',
+ 'name': 'Label12',
+ 'type': 'radio-buttons',
+ 'value': null,
+ 'required': false,
+ 'readOnly': false,
+ 'overrideId': false,
+ 'colspan': 1,
+ 'placeholder': null,
+ 'minLength': 0,
+ 'maxLength': 0,
+ 'minValue': null,
+ 'maxValue': null,
+ 'regexPatt§12212ern': null,
+ 'optionType': null,
+ 'hasEmptyValue': null,
+ 'options': [
+ {
+ 'id': 'option_1',
+ 'name': 'Option 1'
+ },
+ {
+ 'id': 'option_2',
+ 'name': 'Option 2'
+ }
+ ],
+ 'restUrl': null,
+ 'restResponsePath': null,
+ 'restIdProperty': null,
+ 'restLabelProperty': null,
+ 'tab': 'tab1',
+ 'className': null,
+ 'params': {
+ 'existingColspan': 1,
+ 'maxColspan': 2
+ },
+ 'dateDisplayFormat': null,
+ 'layout': {
+ 'row': -1,
+ 'column': -1,
+ 'colspan': 1
+ },
+ 'sizeX': 1,
+ 'sizeY': 1,
+ 'row': -1,
+ 'col': -1,
+ 'visibilityCondition': null,
+ 'endpoint': null,
+ 'requestHeaders': null
+ }
+ ]
+ }
+ }
+ ],
+ 'outcomes': [],
+ 'javascriptEvents': [],
+ 'className': '',
+ 'style': '',
+ 'customFieldTemplates': {},
+ 'metadata': {},
+ 'variables': [],
+ 'customFieldsValueInfo': {},
+ 'gridsterForm': false,
+ 'globalDateFormat': 'D-M-YYYY'
+ };
+ }
+
static getDefinition(): any {
return {
'id': 3003,
diff --git a/demo-shell-ng2/app/components/form/form-demo.component.css b/demo-shell-ng2/app/components/form/form-demo.component.css
index 3608df8b91..ee6f7a61fb 100644
--- a/demo-shell-ng2/app/components/form/form-demo.component.css
+++ b/demo-shell-ng2/app/components/form/form-demo.component.css
@@ -1,3 +1,8 @@
.form-container {
padding: 10px;
}
+
+.store-form-container{
+ width: 80%;
+ height: 80%;
+}
diff --git a/demo-shell-ng2/app/components/form/form-demo.component.html b/demo-shell-ng2/app/components/form/form-demo.component.html
index 8193f015fe..5b993a273c 100644
--- a/demo-shell-ng2/app/components/form/form-demo.component.html
+++ b/demo-shell-ng2/app/components/form/form-demo.component.html
@@ -1,4 +1,32 @@
-
-
-
+
diff --git a/demo-shell-ng2/app/components/form/form-demo.component.ts b/demo-shell-ng2/app/components/form/form-demo.component.ts
index 5ad24ab3f4..9ba8d6e2bc 100644
--- a/demo-shell-ng2/app/components/form/form-demo.component.ts
+++ b/demo-shell-ng2/app/components/form/form-demo.component.ts
@@ -15,9 +15,12 @@
* limitations under the License.
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { FormModel, FormService } from 'ng2-activiti-form';
import { DemoForm } from './demo-form';
+import { ActivitiForm } from 'ng2-activiti-form';
+
+declare var componentHandler;
@Component({
selector: 'form-demo',
@@ -26,9 +29,17 @@ import { DemoForm } from './demo-form';
'form-demo.component.css'
]
})
-export class FormDemoComponent implements OnInit {
+export class FormDemoComponent implements OnInit, AfterViewInit {
+
+ @ViewChild(ActivitiForm)
+ activitiForm: ActivitiForm;
form: FormModel;
+ activeTab: string = 'demo';
+ storedData: any = {};
+ restoredData: any = {};
+ formToLoadName: string = null;
+ showError: boolean = false;
constructor(private formService: FormService) {
formService.executeOutcome.subscribe(e => {
@@ -43,4 +54,69 @@ export class FormDemoComponent implements OnInit {
console.log(form);
this.form = form;
}
+
+ ngAfterViewInit() {
+ // workaround for MDL issues with dynamic components
+ if (componentHandler) {
+ componentHandler.upgradeAllRegistered();
+ }
+ }
+
+ changeToStoreForm() {
+ this.activeTab = 'store';
+ this.showError = false;
+ }
+
+ changeToDemoForm() {
+ this.activeTab = 'demo';
+ let formDefinitionJSON: any = DemoForm.getDefinition();
+ let demoForm = this.formService.parseForm(formDefinitionJSON);
+ this.form = demoForm;
+ }
+
+ store() {
+ this.clone(this.activitiForm.form.values, this.storedData);
+ console.log('DATA SAVED');
+ console.log(this.storedData);
+ console.log('DATA SAVED');
+ this.restoredData = null;
+ }
+
+ restore() {
+ this.restoredData = this.storedData;
+ this.storedData = {};
+ }
+
+ clone(objToCopyFrom, objToCopyTo) {
+ for (let attribute in objToCopyFrom) {
+ if (objToCopyFrom.hasOwnProperty(attribute)) {
+ objToCopyTo[attribute] = objToCopyFrom[attribute];
+ }
+ }
+ return objToCopyTo;
+ }
+
+ loadForm() {
+ if (this.formToLoadName) {
+ this.showError = false;
+ this.formService
+ .getFormDefinitionByName(this.formToLoadName)
+ .debounceTime(7000)
+ .subscribe(
+ id => {
+ this.formService.getFormDefinitionById(id).subscribe(
+ form => {
+ this.form = this.formService.parseForm((form);
+ },
+ (error) => {
+ this.showError = true;
+ }
+ );
+ },
+ (error) => {
+ this.showError = true;
+ }
+ );
+ }
+ }
}
diff --git a/ng2-components/ng2-activiti-form/README.md b/ng2-components/ng2-activiti-form/README.md
index 2877e84f06..dc8c339051 100644
--- a/ng2-components/ng2-activiti-form/README.md
+++ b/ng2-components/ng2-activiti-form/README.md
@@ -174,13 +174,14 @@ The recommended set of properties can be found in the following table:
### Events
-| Name | Description |
-| --- | --- |
-| formLoaded | Invoked when form is loaded or reloaded. |
-| formSaved | Invoked when form is submitted with `Save` or custom outcomes. |
-| formCompleted | Invoked when form is submitted with `Complete` outcome. |
-| executeOutcome | Invoked when any outcome is executed, default behaviour can be prevented via `event.preventDefault()` |
-| onError | Invoked at any error |
+| Name | Return Type | Description |
+| --- | --- | --- |
+| formLoaded | [FormModel](https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts) | Invoked when form is loaded or reloaded. |
+| formSaved | [FormModel](https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts) | Invoked when form is submitted with `Save` or custom outcomes. |
+| formCompleted | [FormModel](https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts) | Invoked when form is submitted with `Complete` outcome. |
+| formDataRefreshed | [FormModel](https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts) | Invoked when form values are refreshed due a data property change |
+| executeOutcome | [FormOutcomeEvent](https://github.com/Alfresco/alfresco-ng2-components/blob/master/ng2-components/ng2-activiti-form/src/components/widgets/core/form-outcome-event.model.ts) | Invoked when any outcome is executed, default behaviour can be prevented via `event.preventDefault()` |
+| onError | any | Invoked at any error |
All `form*` events receive an instance of the `FormModel` as event argument for ease of development:
diff --git a/ng2-components/ng2-activiti-form/src/assets/activiti-form.component.mock.ts b/ng2-components/ng2-activiti-form/src/assets/activiti-form.component.mock.ts
new file mode 100644
index 0000000000..64080265a7
--- /dev/null
+++ b/ng2-components/ng2-activiti-form/src/assets/activiti-form.component.mock.ts
@@ -0,0 +1,275 @@
+/*!
+ * @license
+ * Copyright 2016 Alfresco Software, Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export let fakeForm = {
+ id: 1001,
+ name: 'ISSUE_FORM',
+ processDefinitionId: 'ISSUE_APP:1:2504',
+ processDefinitionName: 'ISSUE_APP',
+ processDefinitionKey: 'ISSUE_APP',
+ taskId: '7506',
+ taskDefinitionKey: 'sid-F67A2996-1684-4774-855A-4591490081FD',
+ tabs: [],
+ fields: [
+ {
+ fieldType: 'ContainerRepresentation',
+ id: '1498212398417',
+ name: 'Label',
+ type: 'container',
+ value: null,
+ required: false,
+ readOnly: false,
+ overrideId: false,
+ colspan: 1,
+ placeholder: null,
+ minLength: 0,
+ maxLength: 0,
+ minValue: null,
+ maxValue: null,
+ regexPattern: null,
+ optionType: null,
+ hasEmptyValue: null,
+ options: null,
+ restUrl: null,
+ restResponsePath: null,
+ restIdProperty: null,
+ restLabelProperty: null,
+ tab: null,
+ className: null,
+ dateDisplayFormat: null,
+ layout: null,
+ sizeX: 2,
+ sizeY: 1,
+ row: -1,
+ col: -1,
+ visibilityCondition: null,
+ numberOfColumns: 2,
+ fields: {
+ 1: [
+ {
+ fieldType: 'RestFieldRepresentation',
+ id: 'label',
+ name: 'Label',
+ type: 'dropdown',
+ value: 'Choose one...',
+ required: false,
+ readOnly: false,
+ overrideId: false,
+ colspan: 1,
+ placeholder: null,
+ minLength: 0,
+ maxLength: 0,
+ minValue: null,
+ maxValue: null,
+ regexPattern: null,
+ optionType: null,
+ hasEmptyValue: true,
+ options: [
+ {
+ id: 'empty',
+ name: 'Choose one...'
+ },
+ {
+ id: 'option_1',
+ name: 'test1'
+ },
+ {
+ id: 'option_2',
+ name: 'test2'
+ },
+ {
+ id: 'option_3',
+ name: 'test3'
+ }
+ ],
+ restUrl: null,
+ restResponsePath: null,
+ restIdProperty: null,
+ restLabelProperty: null,
+ tab: null,
+ className: null,
+ params: {
+ existingColspan: 1,
+ maxColspan: 2
+ },
+ dateDisplayFormat: null,
+ layout: {
+ row: -1,
+ column: -1,
+ colspan: 1
+ },
+ sizeX: 1,
+ sizeY: 1,
+ row: -1,
+ col: -1,
+ visibilityCondition: null,
+ endpoint: null,
+ requestHeaders: null
+ }
+ ],
+ 2: [
+ {
+ fieldType: 'RestFieldRepresentation',
+ id: 'raduio',
+ name: 'raduio',
+ type: 'radio-buttons',
+ value: null,
+ required: false,
+ readOnly: false,
+ overrideId: false,
+ colspan: 1,
+ placeholder: null,
+ minLength: 0,
+ maxLength: 0,
+ minValue: null,
+ maxValue: null,
+ regexPattern: null,
+ optionType: null,
+ hasEmptyValue: null,
+ options: [
+ {
+ id: 'option_1',
+ name: 'Option 1'
+ },
+ {
+ id: 'option_2',
+ name: 'Option 2'
+ },
+ {
+ id: 'option_3',
+ name: 'Option 3'
+ }
+ ],
+ restUrl: null,
+ restResponsePath: null,
+ restIdProperty: null,
+ restLabelProperty: null,
+ tab: null,
+ className: null,
+ params: {
+ existingColspan: 1,
+ maxColspan: 1
+ },
+ dateDisplayFormat: null,
+ layout: {
+ row: -1,
+ column: -1,
+ colspan: 1
+ },
+ sizeX: 1,
+ sizeY: 2,
+ row: -1,
+ col: -1,
+ visibilityCondition: null,
+ endpoint: null,
+ requestHeaders: null
+ }
+ ]
+ }
+ },
+ {
+ fieldType: 'ContainerRepresentation',
+ id: '1498212413062',
+ name: 'Label',
+ type: 'container',
+ value: null,
+ required: false,
+ readOnly: false,
+ overrideId: false,
+ colspan: 1,
+ placeholder: null,
+ minLength: 0,
+ maxLength: 0,
+ minValue: null,
+ maxValue: null,
+ regexPattern: null,
+ optionType: null,
+ hasEmptyValue: null,
+ options: null,
+ restUrl: null,
+ restResponsePath: null,
+ restIdProperty: null,
+ restLabelProperty: null,
+ tab: null,
+ className: null,
+ dateDisplayFormat: null,
+ layout: null,
+ sizeX: 2,
+ sizeY: 1,
+ row: -1,
+ col: -1,
+ visibilityCondition: null,
+ numberOfColumns: 2,
+ fields: {
+ 1: [
+ {
+ fieldType: 'FormFieldRepresentation',
+ id: 'date',
+ name: 'date',
+ type: 'date',
+ value: null,
+ required: false,
+ readOnly: false,
+ overrideId: false,
+ colspan: 1,
+ placeholder: null,
+ minLength: 0,
+ maxLength: 0,
+ minValue: null,
+ maxValue: null,
+ regexPattern: null,
+ optionType: null,
+ hasEmptyValue: null,
+ options: null,
+ restUrl: null,
+ restResponsePath: null,
+ restIdProperty: null,
+ restLabelProperty: null,
+ tab: null,
+ className: null,
+ params: {
+ existingColspan: 1,
+ maxColspan: 2
+ },
+ dateDisplayFormat: null,
+ layout: {
+ row: -1,
+ column: -1,
+ colspan: 1
+ },
+ sizeX: 1,
+ sizeY: 1,
+ row: -1,
+ col: -1,
+ visibilityCondition: null
+ }
+ ],
+ 2: []
+ }
+ }
+ ],
+ outcomes: [],
+ javascriptEvents: [],
+ className: '',
+ style: '',
+ customFieldTemplates: {},
+ metadata: {},
+ variables: [],
+ customFieldsValueInfo: {},
+ gridsterForm: false,
+ globalDateFormat: 'D-M-YYYY'
+};
diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts
index d1d6c42bdb..931c36ced2 100644
--- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts
+++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts
@@ -23,6 +23,7 @@ import { FormModel, FormOutcomeModel, FormFieldModel, FormOutcomeEvent, FormFiel
import { FormService } from './../services/form.service';
import { WidgetVisibilityService } from './../services/widget-visibility.service';
import { NodeService } from './../services/node.service';
+import { fakeForm } from '../assets/activiti-form.component.mock';
describe('ActivitiForm', () => {
@@ -107,14 +108,14 @@ describe('ActivitiForm', () => {
it('should enable custom outcome buttons', () => {
let formModel = new FormModel();
formComponent.form = formModel;
- let outcome = new FormOutcomeModel(formModel, {id: 'action1', name: 'Action 1'});
+ let outcome = new FormOutcomeModel(formModel, { id: 'action1', name: 'Action 1' });
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
});
it('should allow controlling [complete] button visibility', () => {
let formModel = new FormModel();
formComponent.form = formModel;
- let outcome = new FormOutcomeModel(formModel, {id: '$save', name: FormOutcomeModel.SAVE_ACTION});
+ let outcome = new FormOutcomeModel(formModel, { id: '$save', name: FormOutcomeModel.SAVE_ACTION });
formComponent.showSaveButton = true;
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
@@ -127,7 +128,7 @@ describe('ActivitiForm', () => {
let formModel = new FormModel();
formModel.readOnly = true;
formComponent.form = formModel;
- let outcome = new FormOutcomeModel(formModel, {id: '$complete', name: FormOutcomeModel.COMPLETE_ACTION});
+ let outcome = new FormOutcomeModel(formModel, { id: '$complete', name: FormOutcomeModel.COMPLETE_ACTION });
formComponent.showCompleteButton = true;
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
@@ -137,23 +138,23 @@ describe('ActivitiForm', () => {
let formModel = new FormModel();
formModel.readOnly = true;
formComponent.form = formModel;
- let outcome = new FormOutcomeModel(formModel, {id: '$save', name: FormOutcomeModel.SAVE_ACTION});
+ let outcome = new FormOutcomeModel(formModel, { id: '$save', name: FormOutcomeModel.SAVE_ACTION });
formComponent.showSaveButton = true;
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeFalsy();
});
it('should show [custom-outcome] button with readOnly form and selected custom-outcome', () => {
- let formModel = new FormModel({selectedOutcome: 'custom-outcome'});
+ let formModel = new FormModel({ selectedOutcome: 'custom-outcome' });
formModel.readOnly = true;
formComponent.form = formModel;
- let outcome = new FormOutcomeModel(formModel, {id: '$customoutome', name: 'custom-outcome'});
+ let outcome = new FormOutcomeModel(formModel, { id: '$customoutome', name: 'custom-outcome' });
formComponent.showCompleteButton = true;
formComponent.showSaveButton = true;
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
- outcome = new FormOutcomeModel(formModel, {id: '$customoutome2', name: 'custom-outcome2'});
+ outcome = new FormOutcomeModel(formModel, { id: '$customoutome2', name: 'custom-outcome2' });
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeFalsy();
});
@@ -161,7 +162,7 @@ describe('ActivitiForm', () => {
let formModel = new FormModel();
formModel.readOnly = false;
formComponent.form = formModel;
- let outcome = new FormOutcomeModel(formModel, {id: '$save', name: FormOutcomeModel.COMPLETE_ACTION});
+ let outcome = new FormOutcomeModel(formModel, { id: '$save', name: FormOutcomeModel.COMPLETE_ACTION });
formComponent.showCompleteButton = true;
expect(formComponent.isOutcomeButtonVisible(outcome, formComponent.form.readOnly)).toBeTruthy();
@@ -191,7 +192,7 @@ describe('ActivitiForm', () => {
it('should get process variable if is a process task', () => {
spyOn(formService, 'getTaskForm').and.callFake((taskId) => {
return Observable.create(observer => {
- observer.next({taskId: taskId});
+ observer.next({ taskId: taskId });
observer.complete();
});
});
@@ -199,7 +200,7 @@ describe('ActivitiForm', () => {
spyOn(visibilityService, 'getTaskProcessVariable').and.returnValue(Observable.of({}));
spyOn(formService, 'getTask').and.callFake((taskId) => {
return Observable.create(observer => {
- observer.next({taskId: taskId, processDefinitionId: '10201'});
+ observer.next({ taskId: taskId, processDefinitionId: '10201' });
observer.complete();
});
});
@@ -214,7 +215,7 @@ describe('ActivitiForm', () => {
it('should not get process variable if is not a process task', () => {
spyOn(formService, 'getTaskForm').and.callFake((taskId) => {
return Observable.create(observer => {
- observer.next({taskId: taskId});
+ observer.next({ taskId: taskId });
observer.complete();
});
});
@@ -222,7 +223,7 @@ describe('ActivitiForm', () => {
spyOn(visibilityService, 'getTaskProcessVariable').and.returnValue(Observable.of({}));
spyOn(formService, 'getTask').and.callFake((taskId) => {
return Observable.create(observer => {
- observer.next({taskId: taskId, processDefinitionId: 'null'});
+ observer.next({ taskId: taskId, processDefinitionId: 'null' });
observer.complete();
});
});
@@ -259,7 +260,7 @@ describe('ActivitiForm', () => {
const taskId = '
';
let change = new SimpleChange(null, taskId, true);
- formComponent.ngOnChanges({'taskId': change});
+ formComponent.ngOnChanges({ 'taskId': change });
expect(formComponent.getFormByTaskId).toHaveBeenCalledWith(taskId);
});
@@ -269,7 +270,7 @@ describe('ActivitiForm', () => {
const formId = '123';
let change = new SimpleChange(null, formId, true);
- formComponent.ngOnChanges({'formId': change});
+ formComponent.ngOnChanges({ 'formId': change });
expect(formComponent.getFormDefinitionByFormId).toHaveBeenCalledWith(formId);
});
@@ -279,7 +280,7 @@ describe('ActivitiForm', () => {
const formName = '