mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[MNT-25558] Folder rules - respect multivalued properties (#5184)
This commit is contained in:
@@ -45,6 +45,13 @@ export const actionDefListMock = {
|
|||||||
mandatory: true,
|
mandatory: true,
|
||||||
displayLabel: 'Mock action parameter text'
|
displayLabel: 'Mock action parameter text'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'mock-action-parameter-text-multi',
|
||||||
|
type: 'd:text',
|
||||||
|
multiValued: true,
|
||||||
|
mandatory: false,
|
||||||
|
displayLabel: 'Mock action parameter text multi'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'mock-action-parameter-boolean',
|
name: 'mock-action-parameter-boolean',
|
||||||
type: 'd:boolean',
|
type: 'd:boolean',
|
||||||
@@ -97,6 +104,15 @@ const actionParam1TransformedMock: ActionParameterDefinitionTransformed = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actionParam2TransformedMock: ActionParameterDefinitionTransformed = {
|
const actionParam2TransformedMock: ActionParameterDefinitionTransformed = {
|
||||||
|
name: 'mock-action-parameter-text-multi',
|
||||||
|
type: 'd:text',
|
||||||
|
multiValued: true,
|
||||||
|
mandatory: false,
|
||||||
|
displayLabel: 'Mock action parameter text multi',
|
||||||
|
parameterConstraintName: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
const actionParam3TransformedMock: ActionParameterDefinitionTransformed = {
|
||||||
name: 'mock-action-parameter-boolean',
|
name: 'mock-action-parameter-boolean',
|
||||||
type: 'd:boolean',
|
type: 'd:boolean',
|
||||||
multiValued: false,
|
multiValued: false,
|
||||||
@@ -105,7 +121,7 @@ const actionParam2TransformedMock: ActionParameterDefinitionTransformed = {
|
|||||||
parameterConstraintName: ''
|
parameterConstraintName: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
const actionParam3TransformedMock: ActionParameterDefinitionTransformed = {
|
const actionParam4TransformedMock: ActionParameterDefinitionTransformed = {
|
||||||
name: 'aspect-name',
|
name: 'aspect-name',
|
||||||
type: 'd:qname',
|
type: 'd:qname',
|
||||||
multiValued: false,
|
multiValued: false,
|
||||||
@@ -114,7 +130,7 @@ const actionParam3TransformedMock: ActionParameterDefinitionTransformed = {
|
|||||||
parameterConstraintName: 'ac-aspects'
|
parameterConstraintName: 'ac-aspects'
|
||||||
};
|
};
|
||||||
|
|
||||||
const actionParam4TransformedMock: ActionParameterDefinitionTransformed = {
|
const actionParam5TransformedMock: ActionParameterDefinitionTransformed = {
|
||||||
name: 'mock-action-parameter-noderef',
|
name: 'mock-action-parameter-noderef',
|
||||||
type: 'd:noderef',
|
type: 'd:noderef',
|
||||||
multiValued: false,
|
multiValued: false,
|
||||||
@@ -123,7 +139,7 @@ const actionParam4TransformedMock: ActionParameterDefinitionTransformed = {
|
|||||||
parameterConstraintName: ''
|
parameterConstraintName: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
const actionParam5TransformedMock: ActionParameterDefinitionTransformed = {
|
const actionParam6TransformedMock: ActionParameterDefinitionTransformed = {
|
||||||
name: 'aspect-name',
|
name: 'aspect-name',
|
||||||
type: 'd:noderef',
|
type: 'd:noderef',
|
||||||
multiValued: false,
|
multiValued: false,
|
||||||
@@ -168,7 +184,8 @@ const action1TransformedMock: ActionDefinitionTransformed = {
|
|||||||
actionParam2TransformedMock,
|
actionParam2TransformedMock,
|
||||||
actionParam3TransformedMock,
|
actionParam3TransformedMock,
|
||||||
actionParam4TransformedMock,
|
actionParam4TransformedMock,
|
||||||
actionParam5TransformedMock
|
actionParam5TransformedMock,
|
||||||
|
actionParam6TransformedMock
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -209,7 +226,7 @@ export const actionNodeTransformedMock: ActionDefinitionTransformed = {
|
|||||||
title: 'mock-action-5-definition',
|
title: 'mock-action-5-definition',
|
||||||
applicableTypes: [],
|
applicableTypes: [],
|
||||||
trackStatus: false,
|
trackStatus: false,
|
||||||
parameterDefinitions: [actionParam5TransformedMock]
|
parameterDefinitions: [actionParam6TransformedMock]
|
||||||
};
|
};
|
||||||
|
|
||||||
export const actionsTransformedListMock: ActionDefinitionTransformed[] = [action1TransformedMock, action2TransformedMock];
|
export const actionsTransformedListMock: ActionDefinitionTransformed[] = [action1TransformedMock, action2TransformedMock];
|
||||||
|
|||||||
+13
-9
@@ -128,13 +128,17 @@ describe('RuleActionUiComponent', () => {
|
|||||||
await changeMatSelectValue('Action 1 title');
|
await changeMatSelectValue('Action 1 title');
|
||||||
|
|
||||||
const cardView = getPropertiesCardView();
|
const cardView = getPropertiesCardView();
|
||||||
|
const multiValuedProperties = cardView.properties.filter((property: CardViewTextItemModel) => property.multivalued);
|
||||||
|
|
||||||
expect(cardView.properties.length).toBe(5);
|
expect(cardView.properties.length).toBe(6);
|
||||||
expect(cardView.properties[0]).toBeInstanceOf(CardViewTextItemModel);
|
expect(cardView.properties[0]).toBeInstanceOf(CardViewTextItemModel);
|
||||||
expect(cardView.properties[1]).toBeInstanceOf(CardViewBoolItemModel);
|
expect(cardView.properties[1]).toBeInstanceOf(CardViewTextItemModel);
|
||||||
expect(cardView.properties[2]).toBeInstanceOf(CardViewSelectItemModel);
|
expect(cardView.properties[2]).toBeInstanceOf(CardViewBoolItemModel);
|
||||||
expect(cardView.properties[3]).toBeInstanceOf(CardViewTextItemModel);
|
expect(cardView.properties[3]).toBeInstanceOf(CardViewSelectItemModel);
|
||||||
expect(cardView.properties[4]).toBeInstanceOf(CardViewSelectItemModel);
|
expect(cardView.properties[4]).toBeInstanceOf(CardViewTextItemModel);
|
||||||
|
expect(cardView.properties[5]).toBeInstanceOf(CardViewSelectItemModel);
|
||||||
|
expect(multiValuedProperties.length).toBe(1);
|
||||||
|
expect(multiValuedProperties[0].key).toBe('mock-action-parameter-text-multi');
|
||||||
|
|
||||||
await changeMatSelectValue('mock-action-2-definition');
|
await changeMatSelectValue('mock-action-2-definition');
|
||||||
expect(unitTestingUtils.getByDirective(CardViewComponent)).toBeNull();
|
expect(unitTestingUtils.getByDirective(CardViewComponent)).toBeNull();
|
||||||
@@ -211,7 +215,7 @@ describe('RuleActionUiComponent', () => {
|
|||||||
|
|
||||||
await changeMatSelectValue('Action 1 title');
|
await changeMatSelectValue('Action 1 title');
|
||||||
expect(tagService.areTagsEnabled).toHaveBeenCalled();
|
expect(tagService.areTagsEnabled).toHaveBeenCalled();
|
||||||
(getPropertiesCardView().properties[2] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
(getPropertiesCardView().properties[3] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
||||||
expect(options).toEqual(
|
expect(options).toEqual(
|
||||||
dummyTagsConstraints[0].constraints.map((constraint) => ({
|
dummyTagsConstraints[0].constraints.map((constraint) => ({
|
||||||
key: constraint.value,
|
key: constraint.value,
|
||||||
@@ -229,7 +233,7 @@ describe('RuleActionUiComponent', () => {
|
|||||||
|
|
||||||
await changeMatSelectValue('Action 1 title');
|
await changeMatSelectValue('Action 1 title');
|
||||||
expect(tagService.areTagsEnabled).toHaveBeenCalled();
|
expect(tagService.areTagsEnabled).toHaveBeenCalled();
|
||||||
(getPropertiesCardView().properties[2] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
(getPropertiesCardView().properties[3] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
||||||
expect(options).toEqual([
|
expect(options).toEqual([
|
||||||
{
|
{
|
||||||
key: 'cm:notTagRelated',
|
key: 'cm:notTagRelated',
|
||||||
@@ -247,7 +251,7 @@ describe('RuleActionUiComponent', () => {
|
|||||||
|
|
||||||
await changeMatSelectValue('Action 1 title');
|
await changeMatSelectValue('Action 1 title');
|
||||||
expect(categoriesService.areCategoriesEnabled).toHaveBeenCalled();
|
expect(categoriesService.areCategoriesEnabled).toHaveBeenCalled();
|
||||||
(getPropertiesCardView().properties[2] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
(getPropertiesCardView().properties[3] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
||||||
expect(options).toEqual(
|
expect(options).toEqual(
|
||||||
dummyCategoriesConstraints[0].constraints.map((constraint) => ({
|
dummyCategoriesConstraints[0].constraints.map((constraint) => ({
|
||||||
key: constraint.value,
|
key: constraint.value,
|
||||||
@@ -265,7 +269,7 @@ describe('RuleActionUiComponent', () => {
|
|||||||
|
|
||||||
await changeMatSelectValue('Action 1 title');
|
await changeMatSelectValue('Action 1 title');
|
||||||
expect(categoryService.areCategoriesEnabled).toHaveBeenCalled();
|
expect(categoryService.areCategoriesEnabled).toHaveBeenCalled();
|
||||||
(getPropertiesCardView().properties[2] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
(getPropertiesCardView().properties[3] as CardViewSelectItemModel<string>).options$.subscribe((options) => {
|
||||||
expect(options).toEqual([
|
expect(options).toEqual([
|
||||||
{
|
{
|
||||||
key: 'cm:notCategoryRelated',
|
key: 'cm:notCategoryRelated',
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ export class RuleActionUiComponent implements ControlValueAccessor, OnInit, OnCh
|
|||||||
label: paramDef.displayLabel + (paramDef.mandatory ? ' *' : ''),
|
label: paramDef.displayLabel + (paramDef.mandatory ? ' *' : ''),
|
||||||
key: paramDef.name,
|
key: paramDef.name,
|
||||||
editable: true,
|
editable: true,
|
||||||
|
multivalued: paramDef.multiValued,
|
||||||
...(paramDef.mandatory
|
...(paramDef.mandatory
|
||||||
? {
|
? {
|
||||||
validators: [
|
validators: [
|
||||||
|
|||||||
Reference in New Issue
Block a user