mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-4760] - fix task form completion with a header field (#4965)
* [ADF-4760] - fix task completion form with header * [ADF-4760] - PR changes
This commit is contained in:
parent
e334a5a179
commit
ba11019e11
@ -43,11 +43,12 @@ export class FormFieldTypes {
|
|||||||
static READONLY_TYPES: string[] = [
|
static READONLY_TYPES: string[] = [
|
||||||
FormFieldTypes.HYPERLINK,
|
FormFieldTypes.HYPERLINK,
|
||||||
FormFieldTypes.DISPLAY_VALUE,
|
FormFieldTypes.DISPLAY_VALUE,
|
||||||
FormFieldTypes.READONLY_TEXT
|
FormFieldTypes.READONLY_TEXT,
|
||||||
|
FormFieldTypes.GROUP
|
||||||
];
|
];
|
||||||
|
|
||||||
static isReadOnlyType(type: string) {
|
static isReadOnlyType(type: string) {
|
||||||
return FormFieldTypes.READONLY_TYPES.indexOf(type) > -1;
|
return FormFieldTypes.READONLY_TYPES.includes(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static isContainerType(type: string) {
|
static isContainerType(type: string) {
|
||||||
|
@ -409,4 +409,38 @@ describe('FormFieldModel', () => {
|
|||||||
const field = new FormFieldModel(form, {});
|
const field = new FormFieldModel(form, {});
|
||||||
expect(field).toBeDefined();
|
expect(field).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('header field type should not appear into form values', () => {
|
||||||
|
const form = new FormModel();
|
||||||
|
const field = new FormFieldModel(form, {
|
||||||
|
fieldType: 'HeaderFieldtype',
|
||||||
|
id: 'header_field',
|
||||||
|
name: 'header',
|
||||||
|
type: FormFieldTypes.GROUP,
|
||||||
|
value: '',
|
||||||
|
required: false,
|
||||||
|
readOnly: true
|
||||||
|
});
|
||||||
|
field.updateForm();
|
||||||
|
expect(form.values['header_field']).not.toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('dropdown field type should appear into form values', () => {
|
||||||
|
const form = new FormModel();
|
||||||
|
const field = new FormFieldModel(form, {
|
||||||
|
fieldType: 'HeaderFieldtype',
|
||||||
|
id: 'dropdown_field',
|
||||||
|
name: 'header',
|
||||||
|
type: FormFieldTypes.DROPDOWN,
|
||||||
|
value: 'opt1',
|
||||||
|
required: false,
|
||||||
|
readOnly: true,
|
||||||
|
options: [
|
||||||
|
{id: 'opt1', name: 'Option 1'},
|
||||||
|
{id: 'opt2', name: 'Option 2'}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
field.updateForm();
|
||||||
|
expect(form.values['dropdown_field'].name).toEqual('Option 1');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user