mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
fix undefiend tooltip (#10731)
This commit is contained in:
parent
4249a856c9
commit
3475098f32
@ -1232,4 +1232,28 @@ describe('FormFieldModel', () => {
|
|||||||
expect(FormFieldTypes.isValidatableType(FormFieldTypes.TEXT)).toBeFalse();
|
expect(FormFieldTypes.isValidatableType(FormFieldTypes.TEXT)).toBeFalse();
|
||||||
expect(field.validate()).toBe(true);
|
expect(field.validate()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set the tooltip correctly', () => {
|
||||||
|
const form = new FormModel();
|
||||||
|
const tooltipText = 'This is a tooltip';
|
||||||
|
const field = new FormFieldModel(form, {
|
||||||
|
id: 'field_with_tooltip',
|
||||||
|
name: 'Field with Tooltip',
|
||||||
|
type: 'text',
|
||||||
|
tooltip: tooltipText
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(field.tooltip).toBe(tooltipText);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set the tooltip to an empty string when not set', () => {
|
||||||
|
const form = new FormModel();
|
||||||
|
const field = new FormFieldModel(form, {
|
||||||
|
id: 'field_without_tooltip',
|
||||||
|
name: 'Field without Tooltip',
|
||||||
|
type: 'text'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(field.tooltip).toBe('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -211,7 +211,7 @@ export class FormFieldModel extends FormWidgetModel {
|
|||||||
this.currency = json.currency;
|
this.currency = json.currency;
|
||||||
this.dateDisplayFormat = json.dateDisplayFormat || this.getDefaultDateFormat(json);
|
this.dateDisplayFormat = json.dateDisplayFormat || this.getDefaultDateFormat(json);
|
||||||
this.validationSummary = new ErrorMessageModel();
|
this.validationSummary = new ErrorMessageModel();
|
||||||
this.tooltip = json.tooltip;
|
this.tooltip = json.tooltip || '';
|
||||||
this.selectionType = json.selectionType;
|
this.selectionType = json.selectionType;
|
||||||
this.alignmentType = json.alignmentType;
|
this.alignmentType = json.alignmentType;
|
||||||
this.rule = json.rule;
|
this.rule = json.rule;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user