AAE-33955 Add placeholder for data table widget (preview) (#10796)

* AAE-33955 Add placeholder for data table widget (preview)

* add unit test
This commit is contained in:
Tomasz Gnyp 2025-04-17 15:53:03 +02:00 committed by GitHub
parent 6fb9474d46
commit 1f73f7fe40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

View File

@ -26,5 +26,6 @@
<ng-template #previewTemplate>
<adf-datatable data-automation-id="adf-data-table-widget-preview" />
<div class="adf-preview-placeholder"></div>
</ng-template>
</div>

View File

@ -1,3 +1,11 @@
.adf-data-table-widget-failed-message {
margin: 10px;
}
.adf-preview-placeholder {
background-color: var(--adf-theme-mat-grey-color-50);
height: 100%;
width: 100%;
min-height: 100px;
margin-bottom: 10px;
}

View File

@ -237,6 +237,18 @@ describe('DataTableWidgetComponent', () => {
expect(dataTable).toBeNull();
});
it('should display data table placeholder if form is in preview state', () => {
widget.field = getDataVariable(mockVariableConfig, mockSchemaDefinition, [], mockJsonFormVariable);
spyOn(formCloudService, 'getPreviewState').and.returnValue(true);
fixture.detectChanges();
const previewDataTable = getPreview();
const dataTablePlaceholder = fixture.nativeElement.querySelector('.adf-preview-placeholder');
expect(previewDataTable).toBeTruthy();
expect(dataTablePlaceholder).toBeTruthy();
});
describe('should NOT display error message if', () => {
it('form is in preview state', () => {
widget.field = getDataVariable(mockVariableConfig, mockSchemaDefinition, [], mockJsonFormVariableWithIncompleteData);