AAE-35848 Fix dynamic viewer container scaling (#10932)

* AAE-35848 Fix dynamic viewer container scaling

* AAE-35848 Add unit test

* AAE-35848 Fix custom viewer test
This commit is contained in:
Wojciech Duda
2025-06-13 10:57:11 +02:00
committed by GitHub
parent 441a6aab19
commit 3009fa6dec
2 changed files with 22 additions and 1 deletions

View File

@@ -13,7 +13,7 @@
</div>
@if (urlFile || blobFile) {
<div [hidden]="isLoading" class="adf-viewer-render-main">
<div [style.visibility]="isLoading ? 'hidden' : 'visible'" class="adf-viewer-render-main">
<div class="adf-viewer-render-layout-content adf-viewer__fullscreen-container">
<div class="adf-viewer-render-content-container" [ngSwitch]="viewerType">
<ng-container *ngSwitchCase="'external'">

View File

@@ -278,6 +278,9 @@ describe('ViewerComponent', () => {
fixtureCustom.detectChanges();
await fixtureCustom.whenStable();
fixtureCustom.componentInstance.viewer1.markAsLoaded();
fixtureCustom.detectChanges();
let customContent = getCustomViewerContent(fixtureCustom);
expect(customComponent.extensionsSupportedByTemplates).toEqual(['json', 'test']);
expect(customComponent.extensionTemplates.length).toBe(2);
@@ -291,6 +294,9 @@ describe('ViewerComponent', () => {
fixtureCustom.detectChanges();
await fixtureCustom.whenStable();
fixtureCustom.componentInstance.viewer1.markAsLoaded();
fixtureCustom.detectChanges();
customContent = getCustomViewerContent(fixtureCustom);
expect(customComponent.extensionTemplates[0].isVisible).toBeFalse();
expect(customComponent.extensionTemplates[1].isVisible).toBeTrue();
@@ -410,6 +416,21 @@ describe('ViewerComponent', () => {
expect(component.isSaving.emit).toHaveBeenCalledWith(true);
});
it('should render invisible container during loading', async () => {
component.urlFile = 'fake-url-file.png';
component.viewerType = 'image';
fixture.detectChanges();
component.ngOnChanges();
component.isLoading = true;
await fixture.whenStable();
const container: HTMLDivElement = testingUtils.getByCSS('.adf-viewer-render-main')?.nativeElement;
expect(container).toBeDefined();
expect(container.style.display).not.toBe('none');
expect(container.clientWidth).toBe(0);
expect(container.clientHeight).toBeGreaterThan(0);
});
describe('Attribute', () => {
it('should urlFile present not thrown any error ', () => {
expect(() => {