mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
(#9307) Fix filterExcludedPreset of adf-content-metadata-card configuration to include all excluded properties (#9309)
* fix filterExcludedPreset to include all configurations instead of only the first with exclusions. (#9307) * New test for property exclusion in layout-oriented-config.service (9307)
This commit is contained in:
@@ -320,5 +320,27 @@ describe('LayoutOrientedConfigService', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should include all exclusions passed to filterExcludedPreset', () => {
|
||||
let properties: OrganisedPropertyGroup[] = [{
|
||||
name: 'propGroup',
|
||||
title: 'propGroup',
|
||||
properties: [ { name: 'property1', title: 'Custom title', editable: true } as Property,
|
||||
{ name: 'property2', title: 'Custom title', editable: true } as Property,
|
||||
{ name: 'property3', title: 'Custom title', editable: true } as Property,
|
||||
{ name: 'property4', title: 'Custom title', editable: true } as Property,
|
||||
]}];
|
||||
|
||||
configService = createConfigService([
|
||||
{ title: 'Property group', items: [ { aspect: 'berseria', properties: ['property1', 'property2', 'property3', 'property4'] } ] },
|
||||
{ title: 'Exclude group 1', items: [ { exclude: ['property1'], properties: [] } ] },
|
||||
{ title: 'Exclude group 2', items: [ { exclude: ['property2'], properties: [] } ] },
|
||||
{ title: 'Exclude group 3', items: [ { exclude: ['property3'], properties: [] } ] },
|
||||
]);
|
||||
|
||||
let result = configService.filterExcludedPreset(properties);
|
||||
|
||||
expect(result.length).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -75,7 +75,8 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
||||
public filterExcludedPreset(propertyGroups: OrganisedPropertyGroup[]): OrganisedPropertyGroup[] {
|
||||
let excludedConfig = this.config
|
||||
.map((config) => config.exclude)
|
||||
.find((exclude) => exclude !== undefined);
|
||||
.filter((exclude) => exclude !== undefined)
|
||||
.flat();
|
||||
|
||||
if (excludedConfig === undefined) {
|
||||
excludedConfig = [];
|
||||
|
Reference in New Issue
Block a user