mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[AAE-6087] Update base card view item with optional hint parameter (#7285)
* [AAE-6087] Update base card view item with optional hint parameter * fix typo
This commit is contained in:
parent
09a2aab424
commit
8e9bf9cc9b
@ -26,6 +26,7 @@ export interface CardViewItemProperties {
|
||||
editable?: boolean;
|
||||
clickable?: any;
|
||||
icon?: string;
|
||||
hint?: string;
|
||||
validators?: CardViewItemValidator[];
|
||||
data?: any;
|
||||
constraints?: Constraint[];
|
||||
|
@ -44,6 +44,32 @@ describe('CardViewBaseItemModel', () => {
|
||||
|
||||
expect(itemModel.data).toBe(properties.data);
|
||||
});
|
||||
|
||||
it('should persist the params\' properties as own properties', () => {
|
||||
const allProperties = {
|
||||
...properties,
|
||||
default: 'default-value',
|
||||
editable: true,
|
||||
clickable: true,
|
||||
icon: 'dummy-icon',
|
||||
hint: 'Some hint text',
|
||||
validators: [{} as unknown as CardViewItemValidator],
|
||||
multivalued: true
|
||||
};
|
||||
|
||||
const itemModel = new CarViewCustomItemModel(allProperties);
|
||||
|
||||
expect(itemModel.label).toBe(allProperties.label);
|
||||
expect(itemModel.value).toBe(allProperties.value);
|
||||
expect(itemModel.key).toBe(allProperties.key);
|
||||
expect(itemModel.default).toBe(allProperties.default);
|
||||
expect(itemModel.editable).toBe(allProperties.editable);
|
||||
expect(itemModel.clickable).toBe(allProperties.clickable);
|
||||
expect(itemModel.icon).toBe(allProperties.icon);
|
||||
expect(itemModel.hint).toBe(allProperties.hint);
|
||||
expect(itemModel.validators).toBe(allProperties.validators);
|
||||
expect(itemModel.multivalued).toBe(allProperties.multivalued);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isValid & Validation errors', () => {
|
||||
|
@ -26,6 +26,7 @@ export abstract class CardViewBaseItemModel {
|
||||
editable: boolean;
|
||||
clickable: boolean;
|
||||
icon?: string;
|
||||
hint?: string;
|
||||
validators?: CardViewItemValidator[];
|
||||
data?: any;
|
||||
type?: string;
|
||||
@ -39,6 +40,7 @@ export abstract class CardViewBaseItemModel {
|
||||
this.editable = !!cardViewItemProperties.editable;
|
||||
this.clickable = !!cardViewItemProperties.clickable;
|
||||
this.icon = cardViewItemProperties.icon || '';
|
||||
this.hint = cardViewItemProperties.hint || '';
|
||||
this.validators = cardViewItemProperties.validators || [];
|
||||
this.data = cardViewItemProperties.data || null;
|
||||
this.multivalued = !!cardViewItemProperties.multivalued;
|
||||
|
Loading…
x
Reference in New Issue
Block a user