mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-47042 Add auto grow support to multiline text widget (#11981)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
class="adf-multiline-text-widget {{ field.className }}"
|
class="adf-multiline-text-widget {{ field.className }}"
|
||||||
[class.adf-invalid]="!field.isValid && isTouched()"
|
[class.adf-invalid]="!field.isValid && isTouched()"
|
||||||
[class.adf-readonly]="field.readOnly"
|
[class.adf-readonly]="field.readOnly"
|
||||||
|
[class.adf-multiline-text-widget--capped]="field.params?.autoGrow === false"
|
||||||
>
|
>
|
||||||
<mat-form-field
|
<mat-form-field
|
||||||
floatPlaceholder="never"
|
floatPlaceholder="never"
|
||||||
|
|||||||
@@ -8,6 +8,12 @@
|
|||||||
.adf-label {
|
.adf-label {
|
||||||
top: 20px;
|
top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&--capped textarea.adf-input {
|
||||||
|
max-height: 72px;
|
||||||
|
overflow-y: auto;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-multiline-word-counter:has(.adf-multiline-word-counter-value) {
|
&-multiline-word-counter:has(.adf-multiline-word-counter-value) {
|
||||||
|
|||||||
@@ -79,6 +79,37 @@ describe('MultilineTextWidgetComponentComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('auto grow', () => {
|
||||||
|
it('should not apply the capped modifier when autoGrow is not set (default unbounded)', () => {
|
||||||
|
widget.field = new FormFieldModel(new FormModel({ taskId: '<id>' }), {
|
||||||
|
type: FormFieldTypes.MULTILINE_TEXT
|
||||||
|
});
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(testingUtils.getByCSS('.adf-multiline-text-widget--capped')).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not apply the capped modifier when autoGrow is true', () => {
|
||||||
|
widget.field = new FormFieldModel(new FormModel({ taskId: '<id>' }), {
|
||||||
|
type: FormFieldTypes.MULTILINE_TEXT,
|
||||||
|
params: { autoGrow: true }
|
||||||
|
});
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(testingUtils.getByCSS('.adf-multiline-text-widget--capped')).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should apply the capped modifier when autoGrow is false', () => {
|
||||||
|
widget.field = new FormFieldModel(new FormModel({ taskId: '<id>' }), {
|
||||||
|
type: FormFieldTypes.MULTILINE_TEXT,
|
||||||
|
params: { autoGrow: false }
|
||||||
|
});
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(testingUtils.getByCSS('.adf-multiline-text-widget--capped')).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('when is required', () => {
|
describe('when is required', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
widget.field = new FormFieldModel(new FormModel({ taskId: '<id>' }), {
|
widget.field = new FormFieldModel(new FormModel({ taskId: '<id>' }), {
|
||||||
|
|||||||
Reference in New Issue
Block a user