[AAE-17859] Convert manual C309872 to unit test (#9077)

* [AAE-17859] Convert manual C309872 to unit test

* remove second optional message from toBe call
This commit is contained in:
Tomasz Gnyp
2023-11-17 13:47:52 +01:00
committed by GitHub
parent 606abdb4fd
commit 001d6ee83d
2 changed files with 69 additions and 1 deletions

View File

@@ -422,6 +422,29 @@ describe('Form Renderer Component', () => {
expect(fullWidthElement.style['width']).toBe('100%'); expect(fullWidthElement.style['width']).toBe('100%');
}); });
it('[C309872] - Should display Text widget spans on 2 columns when colspan is set to 2', () => {
formRendererComponent.formDefinition = formService.parseForm(colspanForm.formRepresentation.formDefinition, null, false, false);
fixture.detectChanges();
const twoSpanTextWidgetContainerId = '#field-1ff21afc-7df4-4607-8363-1dc8576e1c8e-container';
const oneSpanTextWidgetContainerId = '#field-f4285ad-g123-1a73-521d-7nm4a7231aul0-container';
const formSizedElement = fixture.nativeElement.querySelector(
`${oneSpanTextWidgetContainerId} section.adf-grid-list-column-view`
);
expectElementToBeVisible(formSizedElement);
const sectionGridElement: HTMLElement[] = fixture.nativeElement.querySelectorAll(
`${oneSpanTextWidgetContainerId} section .adf-grid-list-single-column`
);
sectionGridElement.forEach((element) => {
expect(element.style['width']).toBe('50%');
});
const fullWidthElement = fixture.nativeElement.querySelector(
`${twoSpanTextWidgetContainerId} 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();

View File

@@ -908,7 +908,7 @@ export const colspanForm = {
1: [ 1: [
{ {
id: 'Text04sjhr', id: 'Text04sjhr',
name: 'Text', name: 'TextColspan',
type: 'text', type: 'text',
readOnly: false, readOnly: false,
required: false, required: false,
@@ -925,6 +925,51 @@ export const colspanForm = {
} }
] ]
} }
},
{
id: 'f4285ad-g123-1a73-521d-7nm4a7231aul0',
name: 'Label',
type: 'container',
tab: null,
numberOfColumns: 2,
fields: {
1: [
{
id: 'Text01dask',
name: 'Text',
type: 'text',
readOnly: false,
colspan: 1,
placeholder: null,
minValue: null,
maxValue: null,
required: false,
visibilityCondition: null,
params: {
existingColspan: 1,
maxColspan: 2
}
}
],
2: [
{
id: 'Text02ds21',
name: 'Text',
type: 'text',
readOnly: false,
colspan: 1,
placeholder: null,
minValue: null,
maxValue: null,
required: false,
visibilityCondition: null,
params: {
existingColspan: 1,
maxColspan: 2
}
}
]
}
} }
], ],
outcomes: [], outcomes: [],