mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[ACA-4198] fix appVersion init for multiple versions (#6785)
* fix appVersion init for multiple versions * fix test
This commit is contained in:
parent
e21b777a3c
commit
e7e8fe5cb0
@ -29,9 +29,11 @@
|
||||
placeholder="{{processFilterProperty.label | translate}}"
|
||||
[formControlName]="processFilterProperty.key"
|
||||
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key">
|
||||
<mat-option *ngFor="let propertyOption of processFilterProperty.options" [value]="propertyOption.value" [attr.data-automation-id]="'adf-cloud-edit-process-property-options-' + processFilterProperty.key">
|
||||
{{ propertyOption.label | translate }}
|
||||
</mat-option>
|
||||
<mat-option
|
||||
*ngFor="let propertyOption of processFilterProperty.options"
|
||||
[value]="propertyOption.value"
|
||||
[attr.data-automation-id]="'adf-cloud-edit-process-property-options-' + processFilterProperty.key"
|
||||
>{{ propertyOption.label | translate }}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex="23%" *ngIf="processFilterProperty.type === 'multi-select'" [attr.data-automation-id]="processFilterProperty.key">
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 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.
|
||||
*/
|
||||
|
||||
import { ProcessFilterCloudModel } from './process-filter-cloud.model';
|
||||
|
||||
describe('ProcessFilterCloudModel', () => {
|
||||
it('should use appVersion from the provided object', () => {
|
||||
const model = new ProcessFilterCloudModel({ appVersion: 1 });
|
||||
|
||||
expect(model.appVersion).toBe(1);
|
||||
});
|
||||
|
||||
it('should use appVersionMultiple if provided', () => {
|
||||
const model = new ProcessFilterCloudModel({ appVersionMultiple: [1, 2] });
|
||||
|
||||
expect(model.appVersion).toEqual([1, 2]);
|
||||
});
|
||||
|
||||
it('should use appVersionMultiple over the appVersion if both provided', () => {
|
||||
const model = new ProcessFilterCloudModel({ appVersion: 1, appVersionMultiple: [1, 2] });
|
||||
|
||||
expect(model.appVersion).toEqual([1, 2]);
|
||||
});
|
||||
});
|
@ -60,7 +60,12 @@ export class ProcessFilterCloudModel {
|
||||
this.icon = obj.icon || null;
|
||||
this.index = obj.index || null;
|
||||
this.appName = obj.appName || obj.appName === '' ? obj.appName : null;
|
||||
this.appVersion = obj.appVersion ? obj.appVersion : (obj.appVersionMultiple instanceof Array ? obj.appVersionMultiple : null);
|
||||
this.appVersion = obj.appVersion || null;
|
||||
|
||||
if (obj.appVersionMultiple && Array.isArray(obj.appVersionMultiple) && obj.appVersionMultiple.length > 0) {
|
||||
this.appVersion = obj.appVersionMultiple;
|
||||
}
|
||||
|
||||
this.processInstanceId = obj.processInstanceId || null;
|
||||
this.processName = obj.processName || null;
|
||||
this.initiator = obj.initiator || null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user