mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-5294] - fixed problem on form rendering (#6405)
Co-authored-by: Vito Albano <vitoalbano@vitoalbano-mbp-0120.local>
This commit is contained in:
@@ -325,8 +325,8 @@ describe('Form Renderer Component', () => {
|
|||||||
expect(formRendererComponent.formDefinition.isValid).toBe(true, 'Form should be valid when required field are filled');
|
expect(formRendererComponent.formDefinition.isValid).toBe(true, 'Form should be valid when required field are filled');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C309654] - Should display Number widget spans on 2 columns when colspan is set to 2', async () => {
|
it('[C309654] - Should display Number widget spans on 2 columns when colspan is set to 2 and grid view is active', async () => {
|
||||||
formRendererComponent.formDefinition = formService.parseForm(colspanForm.formRepresentation.formDefinition, null , false, false);
|
formRendererComponent.formDefinition = formService.parseForm(colspanForm.formRepresentation.formDefinition, null , false, true);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const formSizedElement = fixture.nativeElement.querySelector('#field-2bc275fb-e113-4d7d-885f-6e74a7332d40-container div.adf-grid-list');
|
const formSizedElement = fixture.nativeElement.querySelector('#field-2bc275fb-e113-4d7d-885f-6e74a7332d40-container div.adf-grid-list');
|
||||||
@@ -340,6 +340,20 @@ describe('Form Renderer Component', () => {
|
|||||||
expect(fullWidthElement.style['grid-area']).toBe('auto / auto / span 1 / span 2');
|
expect(fullWidthElement.style['grid-area']).toBe('auto / auto / span 1 / span 2');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[C309654] - Should display Number widget spans on 2 columns when colspan is set to 2 and grid view is not active', async () => {
|
||||||
|
formRendererComponent.formDefinition = formService.parseForm(colspanForm.formRepresentation.formDefinition, null , false, false);
|
||||||
|
fixture.detectChanges();
|
||||||
|
await fixture.whenStable();
|
||||||
|
const formSizedElement = fixture.nativeElement.querySelector('#field-2bc275fb-e113-4d7d-885f-6e74a7332d40-container section.adf-grid-list-column-view');
|
||||||
|
expectElementToBeVisible(formSizedElement);
|
||||||
|
const sectionGridElement: HTMLElement[] = fixture.nativeElement.querySelectorAll('#field-2bc275fb-e113-4d7d-885f-6e74a7332d40-container section .adf-grid-list-single-column');
|
||||||
|
sectionGridElement.forEach((element) => {
|
||||||
|
expect(element.style['width']).toBe('50%', 'Elemens is wrong sized for this section');
|
||||||
|
});
|
||||||
|
const fullWidthElement = fixture.nativeElement.querySelector('#field-d52ada4e-cbdc-4f0c-a480-5b85fa00e4f8-container section.adf-grid-list-column-view .adf-grid-list-single-column');
|
||||||
|
expect(fullWidthElement.style['width']).toBe('100%');
|
||||||
|
});
|
||||||
|
|
||||||
it('[C309655] - Should display validation error message when Number widget has invalid value', async () => {
|
it('[C309655] - Should display validation error message when Number widget has invalid value', async () => {
|
||||||
formRendererComponent.formDefinition = formService.parseForm(numberNotRequiredForm.formRepresentation.formDefinition);
|
formRendererComponent.formDefinition = formService.parseForm(numberNotRequiredForm.formRepresentation.formDefinition);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -99,7 +99,7 @@ export class FormModel {
|
|||||||
this.className = json.className || '';
|
this.className = json.className || '';
|
||||||
this.variables = json.variables || [];
|
this.variables = json.variables || [];
|
||||||
this.processVariables = json.processVariables || [];
|
this.processVariables = json.processVariables || [];
|
||||||
this.enableFixedSpace = enableFixedSpace || true;
|
this.enableFixedSpace = enableFixedSpace ? true : false;
|
||||||
|
|
||||||
const tabCache: FormWidgetModelCache<TabModel> = {};
|
const tabCache: FormWidgetModelCache<TabModel> = {};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user