[MNT-24456] aps with adw multi user and group fields do not accept multiple values (#10636)

* [MNT-24456] Allow to select multiple users and groups for task form

* [MNT-24456] Inputs styling

* [MNT-24456] Unit tests, fixed issue for selecting single group

* [MNT-24456] Fixed issue when completing forms with null instead of empty array

* [MNT-24456] Used UnitTestingUtils where possible
This commit is contained in:
AleksanderSklorz
2025-02-13 10:43:02 +01:00
committed by GitHub
parent 430ca84c77
commit 808f836259
12 changed files with 313 additions and 20 deletions

View File

@@ -221,6 +221,40 @@ describe('FormFieldModel', () => {
expect(field.hasEmptyValue).toBe(false);
});
it('should detect multiple values when multiple property of params is true', () => {
const field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.DROPDOWN,
options: [
{ id: 'fake-option-1', name: 'fake label 1' },
{ id: 'fake-option-2', name: 'fake label 2' },
{ id: 'fake-option-3', name: 'fake label 3' }
],
value: [],
params: {
multiple: true
}
});
expect(field.hasMultipleValues).toBeTrue();
});
it('should not detect multiple values when multiple property of params is false', () => {
const field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.DROPDOWN,
options: [
{ id: 'fake-option-1', name: 'fake label 1' },
{ id: 'fake-option-2', name: 'fake label 2' },
{ id: 'fake-option-3', name: 'fake label 3' }
],
value: [],
params: {
multiple: false
}
});
expect(field.hasMultipleValues).toBeFalse();
});
describe('should leave not resolved value (in case of delayed options)', () => {
it('when string', () => {
const field = new FormFieldModel(new FormModel(), {

View File

@@ -141,7 +141,7 @@ export class FormFieldModel extends FormWidgetModel {
}
get hasMultipleValues() {
return this.selectionType === 'multiple';
return this.selectionType === 'multiple' || this.params.multiple;
}
markAsInvalid() {

View File

@@ -90,6 +90,7 @@
--adf-secondary-button-background: $adf-secondary-button-background,
--adf-secondary-modal-text-color: $adf-secondary-modal-text-color,
--adf-disabled-button-background: $adf-disabled-button-background,
--adf-chip-border-color: $adf-chip-border-color,
--adf-display-external-property-widget-preview-selection-color: mat.get-color-from-palette($foreground, secondary-text)
);

View File

@@ -29,3 +29,4 @@ $adf-error-color: #ba1b1b;
$adf-secondary-button-background: #2121210d;
$adf-secondary-modal-text-color: #212121;
$adf-disabled-button-background: rgba(0, 0, 0, 0.12);
$adf-chip-border-color: #757575;