mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
added changes to reflect the default option for dropdown
This commit is contained in:
committed by
Mario Romano
parent
f844b0d65f
commit
9d30db9017
@@ -163,12 +163,12 @@ describe('FormFieldModel', () => {
|
||||
id: 'dropdown-2',
|
||||
type: FormFieldTypes.DROPDOWN,
|
||||
options: [
|
||||
{ id: 'opt1', value: 'Option 1' },
|
||||
{ id: 'opt2', value: 'Option 2' }
|
||||
{ id: 'opt1', name: 'Option 1' },
|
||||
{ id: 'opt2', name: 'Option 2' }
|
||||
]
|
||||
});
|
||||
|
||||
field.value = 'opt2';
|
||||
field.value = 'Option 2';
|
||||
expect(form.values['dropdown-2']).toEqual(field.options[1]);
|
||||
});
|
||||
|
||||
|
@@ -234,7 +234,7 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
if (this.value === 'empty' || this.value === '') {
|
||||
this.form.values[this.id] = {};
|
||||
} else {
|
||||
let entry: FormFieldOption[] = this.options.filter(opt => opt.id === this.value);
|
||||
let entry: FormFieldOption[] = this.options.filter(opt => opt.name === this.value);
|
||||
if (entry.length > 0) {
|
||||
this.form.values[this.id] = entry[0];
|
||||
}
|
||||
|
Reference in New Issue
Block a user