[ADF-5294] - fixed problem on form rendering (#6405)

Co-authored-by: Vito Albano <vitoalbano@vitoalbano-mbp-0120.local>
This commit is contained in:
Vito
2020-12-01 23:58:32 +00:00
committed by GitHub
parent 9bbdee5de0
commit 7f31441946
2 changed files with 17 additions and 3 deletions

View File

@@ -325,8 +325,8 @@ describe('Form Renderer Component', () => {
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 () => {
formRendererComponent.formDefinition = formService.parseForm(colspanForm.formRepresentation.formDefinition, null , false, false);
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, true);
fixture.detectChanges();
await fixture.whenStable();
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');
});
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 () => {
formRendererComponent.formDefinition = formService.parseForm(numberNotRequiredForm.formRepresentation.formDefinition);
fixture.detectChanges();

View File

@@ -99,7 +99,7 @@ export class FormModel {
this.className = json.className || '';
this.variables = json.variables || [];
this.processVariables = json.processVariables || [];
this.enableFixedSpace = enableFixedSpace || true;
this.enableFixedSpace = enableFixedSpace ? true : false;
const tabCache: FormWidgetModelCache<TabModel> = {};