diff --git a/demo-shell/src/app/components/card-view/card-view.component.ts b/demo-shell/src/app/components/card-view/card-view.component.ts
index 1694bb547a..04fb1b74f5 100644
--- a/demo-shell/src/app/components/card-view/card-view.component.ts
+++ b/demo-shell/src/app/components/card-view/card-view.component.ts
@@ -125,6 +125,15 @@ export class CardViewComponent implements OnInit, OnDestroy {
format: 'shortDate',
editable: this.isEditable
}),
+ new CardViewDateItemModel({
+ label: 'CardView Date Item - Multivalue (chips)',
+ value: [new Date(1983, 11, 24, 10, 0, 30)],
+ key: 'date',
+ default: new Date(1983, 11, 24, 10, 0, 30),
+ format: 'shortDate',
+ editable: this.isEditable,
+ multivalued: true
+ }),
new CardViewDatetimeItemModel({
label: 'CardView Datetime Item',
value: new Date(1983, 11, 24, 10, 0, 0),
@@ -133,6 +142,15 @@ export class CardViewComponent implements OnInit, OnDestroy {
format: 'short',
editable: this.isEditable
}),
+ new CardViewDatetimeItemModel({
+ label: 'CardView Datetime Item - Multivalue (chips)',
+ value: [new Date(1983, 11, 24, 10, 0, 0)],
+ key: 'datetime',
+ default: new Date(1983, 11, 24, 10, 0, 0),
+ format: 'short',
+ editable: this.isEditable,
+ multivalued: true
+ }),
new CardViewBoolItemModel({
label: 'CardView Boolean Item',
value: true,
@@ -162,6 +180,15 @@ export class CardViewComponent implements OnInit, OnDestroy {
editable: this.isEditable,
pipes: [{ pipe: this.decimalNumberPipe }]
}),
+ new CardViewFloatItemModel({
+ label: 'CardView Float Item - Multivalue (chips)',
+ value: [9.9],
+ key: 'float',
+ default: 0.0,
+ editable: this.isEditable,
+ multivalued: true,
+ pipes: [{ pipe: this.decimalNumberPipe }]
+ }),
new CardViewKeyValuePairsItemModel({
label: 'CardView Key-Value Pairs Item',
value: [{ name: 'hey', value: 'you' }, { name: 'hey', value: 'you' }],
diff --git a/e2e/core/pages/metadata-view.page.ts b/e2e/core/pages/metadata-view.page.ts
index 501f7e0b2c..b9867f274b 100644
--- a/e2e/core/pages/metadata-view.page.ts
+++ b/e2e/core/pages/metadata-view.page.ts
@@ -25,9 +25,9 @@ export class MetadataViewPage {
aspectTitle: Locator = by.css(`mat-panel-title`);
name = element(by.css(`[data-automation-id='card-textitem-value-properties.cm:name']`));
creator = element(by.css(`[data-automation-id='card-textitem-value-createdByUser.displayName']`));
- createdDate = element(by.css(`span[data-automation-id='card-dateitem-createdAt'] span`));
+ createdDate = element(by.css(`span[data-automation-id='card-dateitem-createdAt']`));
modifier = element(by.css(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`));
- modifiedDate = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt'] span`));
+ modifiedDate = element(by.css(`span[data-automation-id='card-dateitem-modifiedAt']`));
mimetypeName = element(by.css(`[data-automation-id='card-textitem-value-content.mimeTypeName']`));
size = element(by.css(`[data-automation-id='card-textitem-value-content.sizeInBytes']`));
description = element(by.css(`span[data-automation-id='card-textitem-value-properties.cm:description']`));
diff --git a/e2e/process-services/pages/task-details.page.ts b/e2e/process-services/pages/task-details.page.ts
index b28bb6512f..4d16849283 100644
--- a/e2e/process-services/pages/task-details.page.ts
+++ b/e2e/process-services/pages/task-details.page.ts
@@ -35,7 +35,7 @@ export class TaskDetailsPage {
parentTaskIdField = element(by.css('[data-automation-id="card-textitem-value-parentTaskId"] '));
durationField = element(by.css('[data-automation-id="card-textitem-value-duration"] '));
endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first();
- createdField = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
+ createdField = element(by.css('span[data-automation-id="card-dateitem-created"]'));
idField = element.all(by.css('[data-automation-id="card-textitem-value-id"]')).first();
descriptionField = element(by.css('[data-automation-id="card-textitem-value-description"]'));
dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
diff --git a/lib/content-services/src/lib/content-metadata/services/property-groups-translator.service.ts b/lib/content-services/src/lib/content-metadata/services/property-groups-translator.service.ts
index acb70e6a62..d91b4bda12 100644
--- a/lib/content-services/src/lib/content-metadata/services/property-groups-translator.service.ts
+++ b/lib/content-services/src/lib/content-metadata/services/property-groups-translator.service.ts
@@ -119,7 +119,7 @@ export class PropertyGroupTranslatorService {
if (this.isListOfValues(propertyDefinition.constraints)) {
const options = propertyDefinition.constraints[0].parameters.allowedValues.map((value) => ({ key: value, label: value }));
- const properties = Object.assign(propertyDefinition, { options$: of(options) });
+ const properties = Object.assign(propertyDefinition, { options$: of(options) });
cardViewItemProperty = new CardViewSelectItemModel(properties);
} else {
@@ -132,22 +132,35 @@ export class PropertyGroupTranslatorService {
case D_INT:
case D_LONG:
- cardViewItemProperty = new CardViewIntItemModel(propertyDefinition);
+ cardViewItemProperty = new CardViewIntItemModel(Object.assign(propertyDefinition, {
+ multivalued: isMultiValued,
+ pipes: [{ pipe: this.multiValuePipe, params: [this.valueSeparator] }]
+ }));
break;
case D_FLOAT:
case D_DOUBLE:
cardViewItemProperty = new CardViewFloatItemModel(Object.assign(propertyDefinition, {
- pipes: [{ pipe: this.decimalNumberPipe }]
+ multivalued: isMultiValued,
+ pipes: [
+ { pipe: this.decimalNumberPipe },
+ { pipe: this.multiValuePipe, params: [this.valueSeparator] }
+ ]
}));
break;
case D_DATE:
- cardViewItemProperty = new CardViewDateItemModel(propertyDefinition);
+ cardViewItemProperty = new CardViewDateItemModel(Object.assign(propertyDefinition, {
+ multivalued: isMultiValued,
+ pipes: [{ pipe: this.multiValuePipe, params: [this.valueSeparator] }]
+ }));
break;
case D_DATETIME:
- cardViewItemProperty = new CardViewDatetimeItemModel(propertyDefinition);
+ cardViewItemProperty = new CardViewDatetimeItemModel(Object.assign(propertyDefinition, {
+ multivalued: isMultiValued,
+ pipes: [{ pipe: this.multiValuePipe, params: [this.valueSeparator] }]
+ }));
break;
case D_BOOLEAN:
@@ -159,7 +172,7 @@ export class PropertyGroupTranslatorService {
cardViewItemProperty = new CardViewTextItemModel(Object.assign(propertyDefinition, {
multivalued: isMultiValued,
multiline: isMultiValued,
- pipes: [{ pipe: this.multiValuePipe, params: [this.valueSeparator]}]
+ pipes: [{ pipe: this.multiValuePipe, params: [this.valueSeparator] }]
}));
}
}
diff --git a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.html b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.html
index 1b4fe189ec..2c49b32e21 100644
--- a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.html
+++ b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.html
@@ -5,23 +5,23 @@
-
-
- {{ property.displayValue }}
-
+ {{ property.displayValue}}
-
diff --git a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.scss b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.scss
index e9d3e17c52..bc56b67270 100644
--- a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.scss
+++ b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.scss
@@ -13,6 +13,22 @@
float: right;
}
+ &-dateitem-chip-list-container.adf-property-field {
+ margin-bottom: -7px !important;
+ border-bottom: 0;
+ cursor: pointer;
+
+ .adf-dateitem-editable-controls {
+ margin-top: 15px;
+ }
+
+ .mat-datetimepicker-toggle {
+ position: absolute;
+ right: 0;
+ top: -20px;
+ }
+ }
+
&-dateitem-editable {
cursor: pointer;
border-bottom: 1px solid mat-color($foreground, text, 0.42);
@@ -53,6 +69,7 @@
padding-left: 8px;
opacity: 0.3;
}
+
&:hover mat-icon.adf-date-reset-icon {
opacity: 1;
}
diff --git a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts
index 4c69ac0ea3..aaf4e474c9 100644
--- a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts
+++ b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.spec.ts
@@ -25,6 +25,7 @@ import { CardViewDateItemComponent } from './card-view-dateitem.component';
import { CoreTestingModule } from '../../../testing/core.testing.module';
import { ClipboardService } from '../../../clipboard/clipboard.service';
import { AppConfigService } from '@alfresco/adf-core';
+import { CardViewDatetimeItemModel } from './../../models/card-view-datetimeitem.model';
import { TranslateModule } from '@ngx-translate/core';
describe('CardViewDateItemComponent', () => {
@@ -192,7 +193,7 @@ describe('CardViewDateItemComponent', () => {
component.editable = true;
component.property.editable = true;
const cardViewUpdateService = TestBed.inject(CardViewUpdateService);
- const expectedDate = moment('Jul 10 2017', 'MMM DD YY');
+ const expectedDate = moment('Jul 10 2017', 'MMM DD YYYY');
fixture.detectChanges();
const property = { ...component.property };
@@ -231,7 +232,7 @@ describe('CardViewDateItemComponent', () => {
component.editable = false;
fixture.detectChanges();
- const doubleClickEl = fixture.debugElement.query(By.css(`[data-automation-id="card-dateitem-${component.property.key}"] span`));
+ const doubleClickEl = fixture.debugElement.query(By.css(`[data-automation-id="card-dateitem-${component.property.key}"]`));
doubleClickEl.triggerEventHandler('dblclick', new MouseEvent('dblclick'));
fixture.detectChanges();
@@ -346,4 +347,42 @@ describe('CardViewDateItemComponent', () => {
fixture.detectChanges();
expect(component.property.value).toEqual(expectedDate.toDate());
});
+
+ it('should render chips for multivalue dates when chips are enabled', async () => {
+ component.property = new CardViewDateItemModel({
+ label: 'Text label',
+ value: ['Jul 10 2017 00:01:00', 'Jul 11 2017 00:01:00', 'Jul 12 2017 00:01:00'],
+ key: 'textkey',
+ editable: true,
+ multivalued: true
+ });
+
+ fixture.detectChanges();
+ await fixture.whenStable();
+ const valueChips = fixture.debugElement.queryAll(By.css(`mat-chip`));
+ expect(valueChips).not.toBeNull();
+ expect(valueChips.length).toBe(3);
+ expect(valueChips[0].nativeElement.innerText.trim()).toBe('Jul 10, 2017');
+ expect(valueChips[1].nativeElement.innerText.trim()).toBe('Jul 11, 2017');
+ expect(valueChips[2].nativeElement.innerText.trim()).toBe('Jul 12, 2017');
+ });
+
+ it('should render chips for multivalue datetimes when chips are enabled', async () => {
+ component.property = new CardViewDatetimeItemModel({
+ label: 'Text label',
+ value: ['Jul 10 2017 00:01:00', 'Jul 11 2017 00:01:00', 'Jul 12 2017 00:01:00'],
+ key: 'textkey',
+ editable: true,
+ multivalued: true
+ });
+
+ fixture.detectChanges();
+ await fixture.whenStable();
+ const valueChips = fixture.debugElement.queryAll(By.css(`mat-chip`));
+ expect(valueChips).not.toBeNull();
+ expect(valueChips.length).toBe(3);
+ expect(valueChips[0].nativeElement.innerText.trim()).toBe('Jul 10, 2017, 0:01');
+ expect(valueChips[1].nativeElement.innerText.trim()).toBe('Jul 11, 2017, 0:01');
+ expect(valueChips[2].nativeElement.innerText.trim()).toBe('Jul 12, 2017, 0:01');
+ });
});
diff --git a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts
index 924b602130..d1651d75c9 100644
--- a/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts
+++ b/lib/core/card-view/components/card-view-dateitem/card-view-dateitem.component.ts
@@ -89,6 +89,8 @@ export class CardViewDateItemComponent extends BaseCardView
{ ...this.property }, momentDate.toDate());
this.property.value = momentDate.toDate();
+ this.update();
}
}
}
@@ -135,4 +137,24 @@ export class CardViewDateItemComponent extends BaseCardView { ...this.property }, this.property.value);
+ }
+
}
diff --git a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html
index 7635dfafb4..781521d7c3 100644
--- a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html
+++ b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html
@@ -72,7 +72,7 @@
[floatLabel]="'never'">
{
expect(valueChips[0].nativeElement.innerText.trim()).toBe('item1');
expect(valueChips[1].nativeElement.innerText.trim()).toBe('item2');
expect(valueChips[2].nativeElement.innerText.trim()).toBe('item3');
+ });
+ it('should render chips for multivalue integers when chips are enabled', async () => {
+ component.property = new CardViewIntItemModel({
+ label: 'Text label',
+ value: [1, 2, 3],
+ key: 'textkey',
+ editable: true,
+ multivalued: true
+ });
+ component.useChipsForMultiValueProperty = true;
+ component.ngOnChanges({ property: new SimpleChange(null, null, true) });
+
+ fixture.detectChanges();
+ await fixture.whenStable();
+ const valueChips = fixture.debugElement.queryAll(By.css(`mat-chip`));
+ expect(valueChips).not.toBeNull();
+ expect(valueChips.length).toBe(3);
+ expect(valueChips[0].nativeElement.innerText.trim()).toBe('1');
+ expect(valueChips[1].nativeElement.innerText.trim()).toBe('2');
+ expect(valueChips[2].nativeElement.innerText.trim()).toBe('3');
+ });
+
+ it('should render chips for multivalue decimal numbers when chips are enabled', async () => {
+ component.property = new CardViewFloatItemModel({
+ label: 'Text label',
+ value: [1.1, 2.2, 3.3],
+ key: 'textkey',
+ editable: true,
+ multivalued: true
+ });
+ component.useChipsForMultiValueProperty = true;
+ component.ngOnChanges({ property: new SimpleChange(null, null, true) });
+
+ fixture.detectChanges();
+ await fixture.whenStable();
+ const valueChips = fixture.debugElement.queryAll(By.css(`mat-chip`));
+ expect(valueChips).not.toBeNull();
+ expect(valueChips.length).toBe(3);
+ expect(valueChips[0].nativeElement.innerText.trim()).toBe('1.1');
+ expect(valueChips[1].nativeElement.innerText.trim()).toBe('2.2');
+ expect(valueChips[2].nativeElement.innerText.trim()).toBe('3.3');
});
it('should render string for multivalue properties when chips are disabled', async () => {
diff --git a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.ts b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.ts
index 2640b4ddb8..77f9a0b6b7 100644
--- a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.ts
+++ b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
+import { ChangeDetectorRef, Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { CardViewTextItemModel } from '../../models/card-view-textitem.model';
import { CardViewUpdateService } from '../../services/card-view-update.service';
import { BaseCardView } from '../base-card-view';
@@ -68,7 +68,8 @@ export class CardViewTextItemComponent extends BaseCardView textInputValue !== this.editedValue),
+ filter(textInputValue => textInputValue !== this.editedValue && textInputValue !== null),
debounceTime(50),
takeUntil(this.onDestroy$)
)
@@ -125,9 +126,8 @@ export class CardViewTextItemComponent extends BaseCardView { ...this.property }, updatedValue);
- this.property.value = updatedValue;
+ this.property.value = this.prepareValueForUpload(this.property, this.editedValue);
+ this.cardViewUpdateService.update( { ...this.property }, this.property.value);
this.resetErrorMessages();
} else {
this.errors = this.property.getValidationErrors(this.editedValue);
@@ -143,9 +143,10 @@ export class CardViewTextItemComponent extends BaseCardView this.transformDate(date));
+ } else {
+ return this.default ? [this.default] : [];
+ }
} else {
- this.localizedDatePipe = new LocalizedDatePipe();
- return this.localizedDatePipe.transform(this.value, this.format, this.locale);
+ return this.value ? this.transformDate(this.value) : this.default;
}
}
+
+ transformDate(value: any) {
+ this.localizedDatePipe = new LocalizedDatePipe();
+ return this.localizedDatePipe.transform(value, this.format, this.locale);
+ }
}
diff --git a/lib/core/card-view/models/card-view-floatitem.model.ts b/lib/core/card-view/models/card-view-floatitem.model.ts
index a7ce4d6770..0a21591b8a 100644
--- a/lib/core/card-view/models/card-view-floatitem.model.ts
+++ b/lib/core/card-view/models/card-view-floatitem.model.ts
@@ -29,8 +29,12 @@ export class CardViewFloatItemModel extends CardViewTextItemModel implements Car
super(cardViewTextItemProperties);
this.validators.push(new CardViewItemFloatValidator());
- if (cardViewTextItemProperties.value) {
+ if (cardViewTextItemProperties.value && !cardViewTextItemProperties.multivalued) {
this.value = parseFloat(cardViewTextItemProperties.value);
}
}
+
+ get displayValue(): string {
+ return this.applyPipes(this.value);
+ }
}
diff --git a/lib/core/card-view/models/card-view-intitem.model.ts b/lib/core/card-view/models/card-view-intitem.model.ts
index 17cd0cbb8a..468ea4e415 100644
--- a/lib/core/card-view/models/card-view-intitem.model.ts
+++ b/lib/core/card-view/models/card-view-intitem.model.ts
@@ -29,8 +29,12 @@ export class CardViewIntItemModel extends CardViewTextItemModel implements CardV
super(cardViewTextItemProperties);
this.validators.push(new CardViewItemIntValidator());
- if (cardViewTextItemProperties.value) {
+ if (cardViewTextItemProperties.value && !cardViewTextItemProperties.multivalued) {
this.value = parseInt(cardViewTextItemProperties.value, 10);
}
}
+
+ get displayValue(): string {
+ return this.applyPipes(this.value);
+ }
}
diff --git a/lib/core/card-view/models/card-view-textitem.model.ts b/lib/core/card-view/models/card-view-textitem.model.ts
index 0525594e23..05a4d67340 100644
--- a/lib/core/card-view/models/card-view-textitem.model.ts
+++ b/lib/core/card-view/models/card-view-textitem.model.ts
@@ -24,14 +24,12 @@ export class CardViewTextItemModel extends CardViewBaseItemModel implements Card
type: string = 'text';
inputType: string = 'text';
multiline?: boolean;
- multivalued?: boolean;
pipes?: CardViewTextItemPipeProperty[];
clickCallBack?: any;
constructor(cardViewTextItemProperties: CardViewTextItemProperties) {
super(cardViewTextItemProperties);
this.multiline = !!cardViewTextItemProperties.multiline;
- this.multivalued = !!cardViewTextItemProperties.multivalued;
this.pipes = cardViewTextItemProperties.pipes || [];
this.clickCallBack = cardViewTextItemProperties.clickCallBack ? cardViewTextItemProperties.clickCallBack : null;
@@ -44,7 +42,7 @@ export class CardViewTextItemModel extends CardViewBaseItemModel implements Card
return this.applyPipes(this.value);
}
- private applyPipes(displayValue) {
+ applyPipes(displayValue) {
if (this.pipes.length) {
displayValue = this.pipes.reduce((accumulator, { pipe, params = [] }) => {
return pipe.transform(accumulator, ...params);
diff --git a/lib/core/card-view/validators/card-view-item-float.validator.ts b/lib/core/card-view/validators/card-view-item-float.validator.ts
index ef4baada25..71d3ce8d84 100644
--- a/lib/core/card-view/validators/card-view-item-float.validator.ts
+++ b/lib/core/card-view/validators/card-view-item-float.validator.ts
@@ -22,8 +22,13 @@ export class CardViewItemFloatValidator implements CardViewItemValidator {
message = 'CORE.CARDVIEW.VALIDATORS.FLOAT_VALIDATION_ERROR';
isValid(value: any): boolean {
- return value === ''
- || !isNaN(parseFloat(value))
- && isFinite(value);
+ if (Array.isArray(value)) {
+ return value.every(this.isDecimalNumber);
+ }
+ return value === '' || this.isDecimalNumber(value);
+ }
+
+ isDecimalNumber(value: any): boolean {
+ return !isNaN(parseFloat(value)) && isFinite(value);
}
}
diff --git a/lib/core/card-view/validators/card-view-item-int.validator.ts b/lib/core/card-view/validators/card-view-item-int.validator.ts
index 392c4d4471..a4193a7b24 100644
--- a/lib/core/card-view/validators/card-view-item-int.validator.ts
+++ b/lib/core/card-view/validators/card-view-item-int.validator.ts
@@ -22,13 +22,15 @@ export class CardViewItemIntValidator implements CardViewItemValidator {
message = 'CORE.CARDVIEW.VALIDATORS.INT_VALIDATION_ERROR';
isValid(value: any): boolean {
- return value === ''
- || !isNaN(value)
- && this.isIntegerNumber(value);
+ if (Array.isArray(value)) {
+ return value.every(this.isIntegerNumber);
+ }
+
+ return value === '' || !isNaN(value) && this.isIntegerNumber(value);
}
isIntegerNumber(value: any): boolean {
- const parsedNumber = parseFloat(value);
+ const parsedNumber = Number(value);
return (parsedNumber | 0) === parsedNumber;
}
}
diff --git a/lib/core/pipes/decimal-number.pipe.ts b/lib/core/pipes/decimal-number.pipe.ts
index f50b7a04de..b78b009346 100644
--- a/lib/core/pipes/decimal-number.pipe.ts
+++ b/lib/core/pipes/decimal-number.pipe.ts
@@ -71,8 +71,8 @@ export class DecimalNumberPipe implements PipeTransform, OnDestroy {
const actualDigitsInfo = `${actualMinIntegerDigits}.${actualMinFractionDigits}-${actualMaxFractionDigits}`;
const actualLocale = locale || this.defaultLocale;
- const datePipe: DecimalPipe = new DecimalPipe(actualLocale);
- return datePipe.transform(value, actualDigitsInfo);
+ const decimalPipe: DecimalPipe = new DecimalPipe(actualLocale);
+ return decimalPipe.transform(value, actualDigitsInfo);
}
ngOnDestroy(): void {
diff --git a/lib/core/pipes/multi-value.pipe.spec.ts b/lib/core/pipes/multi-value.pipe.spec.ts
index a54ef8fde2..b33ea2b46f 100644
--- a/lib/core/pipes/multi-value.pipe.spec.ts
+++ b/lib/core/pipes/multi-value.pipe.spec.ts
@@ -36,11 +36,16 @@ describe('FullNamePipe', () => {
pipe = TestBed.inject(MultiValuePipe);
});
- it('should add the separator when a list is provided', () => {
+ it('should add the separator when a string list is provided', () => {
const values = ['cat', 'house', 'dog'];
expect(pipe.transform(values)).toBe('cat, house, dog');
});
+ it('should add the separator when a number list is provided', () => {
+ const values = [1, 2, 3];
+ expect(pipe.transform(values)).toBe('1, 2, 3');
+ });
+
it('should add custom separator when set', () => {
const values = ['cat', 'house', 'dog'];
const customSeparator = ' - ';
diff --git a/lib/core/pipes/multi-value.pipe.ts b/lib/core/pipes/multi-value.pipe.ts
index 608b3b56d5..6db5fab54a 100644
--- a/lib/core/pipes/multi-value.pipe.ts
+++ b/lib/core/pipes/multi-value.pipe.ts
@@ -22,13 +22,12 @@ export class MultiValuePipe implements PipeTransform {
static DEFAULT_SEPARATOR = ', ';
- transform(values: string | string [], valueSeparator: string = MultiValuePipe.DEFAULT_SEPARATOR): string {
+ transform(values: any | any[], valueSeparator: string = MultiValuePipe.DEFAULT_SEPARATOR): string {
if (values && values instanceof Array) {
- const valueList = values.map((value) => value.trim());
- return valueList.join(valueSeparator);
+ return values.join(valueSeparator);
}
- return values;
+ return values;
}
}
diff --git a/lib/testing/src/lib/process-services-cloud/pages/task-header-cloud-component.page.ts b/lib/testing/src/lib/process-services-cloud/pages/task-header-cloud-component.page.ts
index ffb992b408..5b6c95879c 100644
--- a/lib/testing/src/lib/process-services-cloud/pages/task-header-cloud-component.page.ts
+++ b/lib/testing/src/lib/process-services-cloud/pages/task-header-cloud-component.page.ts
@@ -28,7 +28,7 @@ export class TaskHeaderCloudPage {
priorityCardSelectItem = new CardSelectItemPage('priority');
dueDateField = element.all(by.css('span[data-automation-id*="dueDate"] span')).first();
categoryCardTextItem = new CardTextItemPage('category');
- createdField = element(by.css('span[data-automation-id="card-dateitem-created"] span'));
+ createdField = element(by.css('span[data-automation-id="card-dateitem-created"]'));
parentNameCardTextItem = new CardTextItemPage('parentName');
parentTaskIdCardTextItem = new CardTextItemPage('parentTaskId');
endDateField = element.all(by.css('span[data-automation-id*="endDate"] span')).first();